IVssBackupComponents::SaveAsXML method

The SaveAsXML method saves the Backup Components Document containing a requester's state information to a specified string. This XML document, which contains the Backup Components Document, should always be securely saved as part of a backup operation.

Syntax

HRESULT SaveAsXML(
  BSTR *pbstrXML
);

Parameters

pbstrXML

Pointer to a string to be used to store the Backup Components Document containing a requester's state information.

Return Value

The following are the valid return codes for this method.

Value Meaning
S_OK
Successfully saved the XML document as the pbstrXML parameter value.
E_INVALIDARG
One of the parameter values is not valid.
E_OUTOFMEMORY
The caller is out of memory or other system resources.
VSS_E_BAD_STATE
The backup components object is not initialized, this method has been called during a restore operation, or this method has not been called within the correct sequence.
VSS_E_UNEXPECTED
Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.

Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This value is not supported until Windows Server 2008 R2 and Windows 7. E_UNEXPECTED is used instead.

Remarks

For a typical backup operation, SaveAsXML should not be called until after both writers and the requester are finished modifying the Backup Components Document.

Writers can continue to modify the Backup Components Document until their successful return from handling the PostSnapshot event (CVssWriter::OnPostSnapshot), or equivalently upon the completion of IVssBackupComponents::DoSnapshotSet.

Requesters will need to continue to modify the Backup Components Document as the backup progresses. In particular, a requester will store a component-by-component record of the success or failure of the backup through calls to the IVssBackupComponents::SetBackupSucceeded method.

Once the requester has finished modifying the Backup Components Document, the requester should use SaveAsXML to save a copy of the document to the backup media.

A Backup Components Document can be saved at earlier points in the life cycle of a backup operation—for instance, to support the generation of transportable shadow copies to be handled on remote machines. (See Importing Transportable Shadow Copied Volumes for more information.)

However, SaveAsXML should never be called prior to IVssBackupComponents::PrepareForBackup, because the Backup Components Document will not have been filled by the requester and the writers.

Requirements

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header vsbackup.h (include VsBackup.h, Vss.h, VsWriter.h)
Library VssApi.lib

See Also

IVssBackupComponents

IVssBackupComponents::GatherWriterMetadata

IVssBackupComponents::InitializeForBackup

IVssBackupComponents::InitializeForRestore

IVssBackupComponents::PrepareForBackup