Share via


SPRestoreInformation.MergeSPPersistedObjectState Method

Merges the configuration settings of the component that is the source of a restoration (Self) into the configuration settings of the target component.

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

Syntax

'Declaration
Public Sub MergeSPPersistedObjectState ( _
    liveObject As SPPersistedObject _
)
'Usage
Dim instance As SPRestoreInformation
Dim liveObject As SPPersistedObject

instance.MergeSPPersistedObjectState(liveObject)
public void MergeSPPersistedObjectState(
    SPPersistedObject liveObject
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

liveObject is a null reference (Nothing in Visual Basic).

NotSupportedException

The type of liveObject is different from the source component (Self).

Remarks

This method is similar to standard Microsoft .NET FrameworkCopyTo methods in that it copies property values from one object to another object of the same type. It is called inside an override of OnRestore(Object, SPRestoreInformation) when the configuration only option has been taken.

If the value of Self. IBackupRestore is not an SPPersistedObject object then no work is done and no exception is thrown.

Examples

The following code shows how the method is called in an override of OnRestore(Object, SPRestoreInformation).

public bool OnRestore(Object sender, SPRestoreInformation info){    SPWebService liveService = SPWebService.GetLiveWebService(info);    //liveService is the restore target.    if (liveService == null)    {        throw new SPException(            SPResource.GetString(                Strings.RestoreWebServiceLiveServiceNotFound));    }    info.MergeSPPersistedObjectState(liveService);    liveService.Update();    // Handle non-merged persisted properties      …}

See Also

Reference

SPRestoreInformation Class

SPRestoreInformation Members

Microsoft.SharePoint.Administration.Backup Namespace