Click or drag to resize

IVssBackupComponentsSetSelectedForRestore Method (Guid, VssComponentType, String, String, Boolean, Guid)

Indicates whether the specified selectable component is selected for restoration to a specified writer instance.

Namespace:  Alphaleonis.Win32.Vss
Assembly:  AlphaVSS.Common (in AlphaVSS.Common.dll) Version: (
void SetSelectedForRestore(
	Guid writerId,
	VssComponentType componentType,
	string logicalPath,
	string componentName,
	bool selectedForRestore,
	Guid instanceId


Type: SystemGuid
Globally unique identifier (GUID) of the writer class.
Type: Alphaleonis.Win32.VssVssComponentType
Type of the component.
Type: SystemString

The logical path of the component. For more information, see Logical Pathing of Components.

The value of the string containing the logical path used here should be the same as was used when the component was added to the backup set using AddComponent(Guid, Guid, VssComponentType, String, String).

The logical path can be .

There are no restrictions on the characters that can appear in a non-null logical path.

Type: SystemString

The name of the component.

The value of the string should not be , and should contain the same component as was used when the component was added to the backup set using AddComponent(Guid, Guid, VssComponentType, String, String).

Type: SystemBoolean
If the value of this parameter is , the selected component has been selected for restoration. If the value is , the selected component has not been selected for restoration.
Type: SystemGuid

GUID of the writer instance.

ArgumentNullExceptionOne of the arguments that cannot be was
ArgumentExceptionOne of the parameter values is not valid.
OutOfMemoryExceptionOut of memory or other system resources.
SystemExceptionUnexpected VSS system error. The error code is logged in the event log.
VssBadStateExceptionThe 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.
VssObjectNotFoundExceptionThe backup component does not exist.
VssInvalidXmlDocumentExceptionThe XML document is not valid. Check the event log for details.

SetSelectedForRestore, which moves a component to a different writer instance, can be called only for a writer that supports running multiple writer instances with the same class ID and supports a requester moving a component to a different writer instance at restore time. To determine whether a writer provides this support, call the BackupSchema method.

SetSelectedForRestore has meaning only for restores taking place in component mode.

SetSelectedForRestore can be called only for components that were explicitly added to the backup document at backup time using AddComponent. Restoring a component that was implicitly selected for backup as part of a component set must be done by calling SetSelectedForRestore on the closest ancestor component that was added to the document. If only this component's data is to be restored, that should be accomplished through the AddRestoreSubcomponent(Guid, VssComponentType, String, String, String, String) method; this can be done only if the component is selectable for restore (see Working with Selectability and Logical Paths).

This method must be called before the PreRestore method.

The distinction between the instanceId and writerId parameters is necessary because it is possible that multiple instances of the same writer are running on the computer.

If the value of the instanceId parameter is Empty, this is equivalent to calling the SetSelectedForRestore(Guid, VssComponentType, String, String, Boolean).

The instanceId parameter is used to specify that the component is to be restored to a different writer instance. If the value of the instanceId parameter is not Empty, it must match the instance ID of a writer instance with the same writer class ID specified in in the writerId parameter.

A writer's class identifier, instance identifier, and instance name can be found in the properties of IVssExamineWriterMetadata.

Note Note
Windows XP and Windows 2003: This method is not supported until Windows 2003 SP1.
See Also