IAddFolderCmd::Initialize

The Initialize method is used to configure the AddFolder operation, including providing the client with the ability to customize the dialog title. This method also enables the client to specify information about the folder to be added, such as the name and parent folder location of the folder, the XML and class behavior for the folder properties, and which object store should contain the folder.

void spIAddFolderCmd->Initialize(_bstr_t bstrDialogTitle,
                                 _bstr_t bstrRootFolderClass,
                                 VARIANT_BOOL bRestrictClass,
                                 _bstr_t bstrPropertiesXml,
                                 _bstr_t bstrObjectStoreName,
                                 _bstr_t bstrParentFolderDisplayName,
                                 _bstr_t bstrParentFolderID);
Parameters
bstrDialogTitle - [in] Required _bstr_t, which specifies the label to display in the title bar of the Add Folder Wizard dialog when the AddFolder command is invoked. By using this parameter, client applications can customize the title that appears at the top of the Wizard dialog to correspond with their application requirements.
bstrRootFolderClass - [in] Required _bstr_t, that specifies the root folder class ID (GUID) to display and select for use by the AddFolder operation, which can be set as follows:

bRestrictClass - [in] Required VARIANT_BOOL, which represents the class ID(s) that should be made available for selection and use by the AddFolder operation. This parameter can be set to the following:

bstrPropertiesXml - [in] Required _bstr_t, the XML which specifies the properties to apply to the folder during the AddFolder operation, where the XML must be of the form:

<properties>
   <property>
      <symname>SymbolicName</symname>
      <values>
         <value>PropertyValue</value>
         <value>...</value></values>
   </property>
   <property>
      ...
   </property>
</properties>

bstrObjectStoreName - [in] Required _bstr_t, which specifies the name of the object store in which to create the new folder. The new folder is added to the folder indicated by the bstrParentFolderID parameter on this object store. In addition, when the Add Folder Wizard is executed, the Select Folder page is not included. However, when the empty string is specified for this parameter, the Select Folder page is made visible, thus allowing the user to choose a parent folder and object store.
bstrParentFolderDisplayName - [in] Required _bstr_t, which specifies the name of the parent folder in which to create the new folder. In addition, this folder name is displayed in the Parent Folder field of the Add Folder Wizard. However, when the empty string is specified for this parameter, the name of the folder indicated by the bstrParentFolderID parameter is displayed in the Parent Folder field.
bstrParentFolderID - [in] Required _bstr_t, which specifies the ID of the parent folder in which to create the new folder on the object store specified in the bstrObjectStoreName parameter. When the empty string is specified for this parameter, the new folder is added to the object store root. Use of this parameter requires that a valid object store be specified in the bstrObjectStoreName parameter.
Results
This method always returns an HRESULT value of S_OK if successful.
Sample
The following is a fragment from the complete example for the AddFolder command.
   ...
   // Define the XML properties for the folder to Add
   std::cout << "Defining the XML folder properties..." << std::endl;
   _bstr_t bstrPropertiesXml = _T( "" );
   bstrPropertiesXml +=   _T("<properties>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>Name</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>Newly Added Folder</value></values>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>CommentReq</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>This folder contains new information to be added.</value></values>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>SVCPStr</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>This is the SVCPStr property</value></values>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("</properties>");
// Initialize the custom AddFolder command component with the dialog title, // parent folder display name and ID, object store, // as well as the XML properties and class behavior for the folder. _bstr_t bstrDialogTitle = (_T("Customized AddFolder Operation")); _bstr_t bstrRootFolderClass = (_T("{379B665E-1BBA-4BEA-AA4A-BE678369F2CC}")); VARIANT_BOOL bRestrictClass = VARIANT_TRUE; _bstr_t bstrObjectStoreName = (_T("Alaska")); _bstr_t bstrParentFolderDisplayName = (_T("Parent Folder Name")); _bstr_t bstrParentFolderID = (_T("01928938")); std::cout << "Initializing the AddFolder command component..." << std::endl; spIAddFolderCmd->Initialize(bstrDialogTitle, bstrRootFolderClass, bRestrictClass, bstrPropertiesXml, bstrObjectStoreName, bstrParentFolderDisplayName, bstrParentFolderID); ...