NOTE Customers should only use the ICheckinCmd2::Initialize2 method in new development, as well as replace existing implementations of ICheckinCmd::Initialize with ICheckinCmd2::Initialize2.
The Initialize2 method is used to configure the Checkin operation, including providing the client with the ability to customize the dialog title. This method also enables the client to specify information about the item to be checked-in, such as the name and directory location of the file on the local machine, the version object for the item, and the XML for the item properties.
void spICheckinCmd2->Initialize2(_bstr_t bstrDialogTitle, _bstr_t bstrPathName, IObjectStoreItemPtr pIObjectStoreItem, _bstr_t bstrRootDocClass, VARIANT_BOOL bRestrictClass, _bstr_t bstrPropertiesXml);
bRestrictClass
- [in] Required VARIANT_BOOL, which
represents the class ID(s) that should be made available for selection and
use by the Checkin operation. This parameter can be set to the following:VARIANT_TRUE
, only allow the root document class ID specified
in bstrRootDocClass to be selected.VARIANT_FALSE
, allow the root document class ID specified
in bstrRootDocClass or any of its' children to be selected.bRestrictClass
has been set to true or false.
<properties>
<property>
<symname>SymbolicName</symname>
<values>
<value>PropertyValue</value>
<value>...</value></values>
</property>
<property>
...
</property>
</properties>
... // Instantiate the ObjectStoreItem component to hold // the version object for the checked-out item IObjectStoreItemPtr spIObjectStoreItem; hResult = spIObjectStoreItem.CreateInstance(__uuidof(ObjectStoreItem));
if (FAILED(hResult)) {
std::cout << "Could not create the ObjectStoreItem component.\n"; _ASSERTE(0);
} // Initialize the ObjectStoreItem component with // the items' type, name, version series ID and version ID. ItemType eItemType = eItemTypeDocument; _bstr_t bstrObjectStoreName = (_T("Alaska")); _bstr_t bstrVersionSeriesID = (_T("{6BC064A2-2D58-4B0A-AEF2-B2F8A1100000}")); _bstr_t bstrVersionID = (_T("{DDE54469-36D9-4fe9-8676-445E4994DE1F}")); std::cout << "Initializing the ObjectStoreItem component..." << std::endl;
spIObjectStoreItem->Initialize(eItemType, bstrObjectStoreName, bstrVersionSeriesID, bstrVersionID); // Define the XML properties for the item to Add std::cout << "Defining the XML item properties..." << std::endl; _bstr_t bstrPropertiesXml = _T( "" ); bstrPropertiesXml += _T("<properties>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>DocumentTitle</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>AddedDocument.doc</value></values>");
bstrPropertiesXml += _T("</property>");
bstrPropertiesXml += _T("<property>");
bstrPropertiesXml += _T("<symname>CommentReq</symname>"); bstrPropertiesXml += _T("<values>");
bstrPropertiesXml += _T("<value>This document contains new information to be checked-in.</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 Checkin command component with the dialog title, // name and directory location of the file on the local machine, // as well as the XML properties. _bstr_t bstrDialogTitle = (_T("Customized Checkin Operation")); _bstr_t bstrPathName = (_T("C:\Temp\DocumentToBeCheckedIn.doc")); _bstr_t bstrRootDocClass = (_T("{379B665E-1BBA-4BEA-AA4A-BE678369F2CC}")); VARIANT_BOOL bRestrictClass = VARIANT_TRUE; std::cout << "Initializing the Checkin command component..." << std::endl; spICheckinCmd2->Initialize2(bstrDialogTitle, bstrPathName, spIObjectStoreItem, bstrRootDocClass, bRestrictClass, bstrPropertiesXml);
...