SPBackupRestoreInformation.SetParameter method

Adds the specified key-value pair to an internal store of parameters.

Namespace:  Microsoft.SharePoint.Administration.Backup
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub SetParameter ( _
    key As String, _
    value As Object _
)
'Usage
Dim instance As SPBackupRestoreInformation
Dim key As String
Dim value As Object

instance.SetParameter(key, value)
public void SetParameter(
    string key,
    Object value
)

Parameters

  • key
    Type: System.String

    The parameter name, which serves as a lookup key.

  • value
    Type: System.Object

    The object assigned to the parameter as its value. If this object is of type SPBackupRestoreParameter, then that is what will be saved. If not, then it will be converted into a string via the object's ToString() method and that string will be saved.

Exceptions

Exception Condition
SPException

The SPBackupRestoreInformation object is read-only. (See Remarks for more information.)

Remarks

If the parameter key is either "SPDescription", “SPTypeName”, or "SPObjectGroup", the exception is not thrown even if the SPBackupRestoreInformation object is read-only.

Examples

The following example shows how to use the SetParameter method in an implementation of the AddBackupObjects method.

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

See also

Reference

SPBackupRestoreInformation class

SPBackupRestoreInformation members

Microsoft.SharePoint.Administration.Backup namespace