SPBackupRestoreInformation.SetParameter method
將指定之的關鍵值組的名稱新增至內部存放區中的參數。
Namespace: Microsoft.SharePoint.Administration.Backup
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Sub SetParameter ( _
key As String, _
value As Object _
)
'用途
Dim instance As SPBackupRestoreInformation
Dim key As String
Dim value As Object
instance.SetParameter(key, value)
public void SetParameter(
string key,
Object value
)
參數
key
Type: System.String參數名稱,做為查閱索引鍵。
value
Type: System.Object指派給它的值為參數物件。如果此物件的類型SPBackupRestoreParameter,這是什麼將會儲存。如果不使用,然後它會轉換成透過物件的ToString()方法的字串,並將儲存該字串。
Exceptions
Exception | Condition |
---|---|
SPException | SPBackupRestoreInformation物件是唯讀屬性。(如需詳細資訊,請參閱 < 備註 >)。 |
備註
如果參數機碼"SPDescription"、"SPTypeName"或"SPObjectGroup",即使SPBackupRestoreInformation物件是唯讀屬性,是不擲回例外狀況。
Examples
下列範例會示範如何使用SetParameter方法中實作的AddBackupObjects方法。
public void AddBackupObjects(SPBackupRestoreObject parent)
{
if (parent == null)
{
throw new ArgumentNullException("parent");
}
SPBackupRestoreObject self = parent.AddChild(this);
self.Information.SetParameter(SPBackupRestoreObject.SPTypeName, this.GetType());
self.Information.SetParameter(SPBackupRestoreObject.SPDescription, "Description of custom content component");
foreach (ChildContent child in ChildContentCollection)
{
IBackupRestore childIBR = child as IBackupRestore;
childIBR.AddBackupObjects(self);
}
}
Public Sub AddBackupObjects(ByVal parent As SPBackupRestoreObject)
If parent Is Nothing Then
Throw New ArgumentNullException("parent")
End If
Dim self As SPBackupRestoreObject = parent.AddChild(Me)
self.Information.SetParameter(SPBackupRestoreObject.SPTypeName, Me.GetType())
self.Information.SetParameter(SPBackupRestoreObject.SPDescription, "Description of custom content component")
For Each child As ChildContent In ChildContentCollection
Dim childIBR As IBackupRestore = TryCast(child, IBackupRestore)
childIBR.AddBackupObjects(self)
Next child
End Sub
請參閱
參照
SPBackupRestoreInformation class