CancelCheckout Command

The CancelCheckout command silently cancels the checkout operation for a specified object store item. The client application must use the ICancelCheckoutCmd interface to specify the item, for which to cancel the checkout operation.

After the CancelCheckout command has been executed by calling IAppIntCmd::Invoke, a CancelCheckout response component is returned. Client applications may interact with the response component via the standard IAppIntRsp interface. For more information about working with command and response components and their COM interfaces, see Command and Response components.

NOTE The CancelCheckout command does not invoke a graphical user interface, it simply cancels the checkout operation for a specified object store item.

Reference

DLL FnAppIntCancelCheckoutCmd.dll
See Also CheckoutList, Checkin, and QuickCheckin commands

Interfaces

The CancelCheckout command uses the following interfaces:

Interface Description
ICancelCheckoutCmd

This is a custom interface used to initialize the data contained in the CancelCheckout command component. The client application uses this interface to specify the object store item, for which to cancel the checkout operation.

IAppIntCmd

This is a standard interface which is automatically used by the CancelCheckout command to invoke the CancelCheckout command component. The client application executes the CancelCheckout command by calling this interface and passing the AppIntSession component on which the CancelCheckout command component is invoked. Each time the command is executed, an CancelCheckout response component is returned.

IAppIntRsp

This is a standard interface that is automatically used by the CancelCheckout command to determine the success or failure of the command, as well as retrieve any error code or messages.

Example

In the application's StdAfx.h header file:

#import"C:\Program Files\FileNet\AppInt\FnAppIntCmd.tlb"                      named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntHttpRequest.dll"              named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntBrowserDlg.dll"               named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntHttpConnection.dll"           named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntResources.dll"                named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntClientRecordBase.tlb"         named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntClientStore.dll"              named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntSession.dll"                  named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntSessionLogin.dll"             named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntCmdComponents.dll"            named_guids no_namespace
#import "C:\Program Files\FileNet\AppInt\FnAppIntCancelCheckoutCmd.dll"        named_guids no_namespace

In the application's primary .cpp source file:

// Instantiate the StdSessionLogin component
IStdSessionLoginPtr spIStdSessionLogin;
HRESULT hResult = spIStdSessionLogin.CreateInstance(__uuidof(StdSessionLogin));
if (FAILED(hResult)) { std::cout << "Could not create the StdSessionLogin component." << std::endl; _ASSERTE(0); } try {
// Initialize the StdSessionLogin component to create // a separate, non-unified login for the client application // by specifying the session / client application name. std::cout << "Initializing the StdSessionLogin component to use NON-unified login..." << std::endl; _bstr_t sessionName(_T("WordPerfect")); spIStdSessionLogin->InitializeViaSessionName(sessionName);
// Instantiate the AppIntSession component
IAppIntSessionPtr spIAppIntSession;
hResult = spIAppIntSession.CreateInstance(__uuidof(AppIntSession)); if (FAILED(hResult)) { std::cout << "Could not create the AppIntSession component." << std::endl; _ASSERTE(0); } // Initialize the AppIntSession component with the StdSessionLogin component
std::cout << "Initializing the AppIntSession component..." << std::endl;
spIAppIntSession->Initialize(spIStdSessionLogin); // * The Client Application may invoke a SessionLogin here; otherwise, // * it will automatically be invoked as needed when commands are executed. std::cout << "Checking Login Status..." << std::endl; VARIANT_BOOL bIsLoggedIn = spIAppIntSession->IsLoggedIn(); if (bIsLoggedIn == VARIANT_TRUE) { std::cout << "User is currently Logged In." << std::endl; } else {
std::cout << "User is NOT currently Logged In." << std::endl;
std::cout << "Attempting Login..." << std::endl;
hResult = spIAppIntSession->Login(); if (FAILED(hResult)) { std::cout << "Login failed." << std::endl; _ASSERTE(0); }
std::cout << "Login succeeded." << std::endl; } // 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 bstrVersionID = (_T("{DDE54469-36D9-4fe9-8676-445E4994DE1F}")); std::cout << "Initializing the ObjectStoreItem component..." << std::endl;
spIObjectStoreItem->Initialize(enItemType, bstrObjectStoreName, bstrVersionSeriesID, bstrVersionID); // 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); // Execute the CancelCheckout command and capture the response component std::cout << "Executing the CancelCheckout command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spICancelCheckoutCmd);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);
// Determine if the command failed, before accessing response component data hResult = spIAppIntRsp->GetHResult(); if (FAILED(hResult)) { std::cout << "The CancelCheckout command failed to execute." << std::endl; // Examine the error information provided in the standard response component _bstr_t bstrErrorName = spIAppIntRsp->GetErrorName(); std::cout << "ErrorName=" << ( bstrErrorName.length() ? (LPCSTR) bstrErrorName : _T( "" ) ) << std::endl; _bstr_t bstrErrorMsg = spIAppIntRsp->GetErrorMsg(); std::cout << "ErrorMsg=" << ( bstrErrorMsg.length() ? (LPCSTR) bstrErrorMsg : _T( "" ) ) << std::endl; _bstr_t bstrErrorDetails = spIAppIntRsp->GetErrorDetails(); std::cout << "ErrorDetails=" << ( bstrErrorDetails.length() ? (LPCSTR) bstrErrorDetails : _T( "" ) ) << std::endl; _ASSERTE(0); } else { std::cout << "The CancelCheckout command succeeded." << std::endl; // Obtain the response name and description from the standard response component _bstr_t bstrResponseDescription = spIAppIntRsp->GetDescription(); std::cout << "ResponseDescription=" << ( bstrResponseDescription.length() ? (LPCSTR) bstrResponseDescription : _T( "" ) ) << std::endl; _bstr_t bstrResponseName = spIAppIntRsp->GetName(); std::cout << "ResponseName=" << ( bstrResponseName.length() ? (LPCSTR) bstrResponseName : _T( "" ) ) << std::endl; } } catch(...) { }