IVssCreateWriterMetadata::AddComponent method (vswriter.h)
The AddComponent method adds a database or file group as a component to be backed up.
Syntax
HRESULT AddComponent(
[in] VSS_COMPONENT_TYPE ct,
[in] LPCWSTR wszLogicalPath,
[in] LPCWSTR wszComponentName,
[in] LPCWSTR wszCaption,
[in] const BYTE *pbIcon,
[in] UINT cbIcon,
[in] bool bRestoreMetadata,
[in] bool bNotifyOnBackupComplete,
[in] bool bSelectable,
[in] bool bSelectableForRestore,
[in] DWORD dwComponentFlags
);
Parameters
[in] ct
A VSS_COMPONENT_TYPE enumeration value specifying the type of the component.
Windows Server 2003 and Windows XP: Before Windows Server 2003 with SP1, this parameter is reserved for system use, and the caller should not override the default value.
[in] wszLogicalPath
A pointer to a null-terminated wide character string containing the logical path of the database or file group. For more information, see Logical Pathing of Components.
A logical path is optional and can be NULL.
[in] wszComponentName
A pointer to a null-terminated wide character string containing the name of the component. This string is not localized.
This parameter is required and cannot be NULL. The string cannot contain backslashes.
[in] wszCaption
A pointer to a null-terminated wide character string containing a description (also called a "friendly name") for the component. This string might be localized, and therefore requesters must assume that it is localized.
This parameter is optional and can be NULL. The string can contain backslashes.
[in] pbIcon
A pointer to a bitmap of the icon representing the database, to be displayed in a user interface. The size, in bytes, of the buffer is specified by the cbIcon parameter.
If the writer does not want to specify an icon, pbIcon should be set to NULL.
[in] cbIcon
The size, in bytes, of the buffer. If the pbIcon parameter is NULL, cbIcon should be zero.
[in] bRestoreMetadata
This parameter is reserved for future use and should always be set to false.
[in] bNotifyOnBackupComplete
This parameter is reserved for future use and should always be set to false.
[in] bSelectable
A Boolean that indicates whether the component can be optionally backed up (which means it can be excluded from the backup) or is always backed up when any of the writer's component is backed up. The Boolean is true if the component can be selectively backed up and false if it is backed up when any of the components is backed up.
[in] bSelectableForRestore
A Boolean that determines whether a component can be individually restored when it has not been explicitly included in the backup document. If the component was explicitly added to the backup document, it can always be individually selected for restore; in this case, this flag has no meaning.
When true, the component can be restored by itself; when false, the component can be restored only if the entire component set is being restored. (See VSS_COMPONENTINFO and Working with Selectability and Logical Paths for more information).
The default value for this parameter is false.
[in] dwComponentFlags
A bit mask (or bitwise OR) of members of the VSS_COMPONENT_FLAGS enumeration indicating the features that this component supports.
The default value for this argument is zero.
Return value
The following are the valid return codes for this method.
Value | Meaning |
---|---|
|
The operation was successful. |
|
One of the parameter values is not valid. |
|
The caller is out of memory or other system resources. |
|
The XML document is not valid. Check the event log for details. For more information, see Event and Error Handling Under VSS. |
|
The object is a duplicate. A component with the same logical path and component name already exists. |
|
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
This method can be called multiple times to add several components to a writer's metadata.
The combination of logical path and name for each component of a given instance of a given class of writer must be unique. Attempting to call AddComponent twice with the same values of wszLogicalPath and wszComponentName results in a VSS_E_OBJECT_ALREADY_EXISTS error.
AddComponent can be used to add subcomponents—components in which all member files are backed up as a group, but which contain files that can be restored individually. See Working with Selectability for Restore and Subcomponents for more information.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | vswriter.h (include Vss.h, VsWriter.h) |
Library | VssApi.lib |