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)

public void SetParameter(
	string key,
	Object value


Type: System.String

The parameter name, which serves as a lookup key.

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.


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

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

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;