The Initialize method is called to initialize the CancelCheckout command, by specifying the object store item for which to cancel the checkout operation. In order to cancel the checkout operation for the item, the client application must specify the version series ID (GUID) of the object for the item.
void spICancelCheckoutCmd->Initialize(IObjectStoreItemPtr pIObjectStoreItem);
...
// Instantiate the custom CancelCheckout command component
ICancelCheckoutCmdPtr spICancelCheckoutCmd;
hResult = spICancelCheckoutCmd.CreateInstance(__uuidof(CancelCheckoutCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the CancelCheckout command component.\n";
_ASSERTE(0);
}
// Instantiate the ObjectStoreItem component
IObjectStoreItemPtr pIObjectStoreItem;
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, object store name, version series ID and item ID
ItemType enItemType = eItemTypeDocument;
_bstr_t bstrObjectStoreName = (_T("Alaska"));
_bstr_t bstrVersionSeriesID = (_T("{6BC064A2-2D58-4B0A-AEF2-B2F8A1100000}"));
_bstr_t bstrItemID = (_T("{DDE54469-36D9-4fe9-8676-445E4994DE1F}"));
std::cout << "Initializing the ObjectStoreItem component..." << std::endl;
spIObjectStoreItem->Initialize(enItemType, bstrObjectStoreName, bstrVersionSeriesID, bstrItemID);
// Initialize the custom CancelCheckout command component with
// the object store item, for which to cancel the checkout operation.
std::cout << "Initializing the CancelCheckout command component..." << std::endl;
spICancelCheckoutCmd->Initialize(pIObjectStoreItem);
...