The IsCheckedOut command silently determines if a specified object store item is checked-out by the current user. The command is invoked on the reservation object for the item to be checked out. The client application must use the IIsCheckedOutCmd interface to specify the item for which to determine if it is checked out by the current user.
After the IsCheckedOut command has been executed by calling IAppIntCmd::Invoke, an IsCheckedOut response component is returned. Client applications may interact with the response component via the standard IAppIntRsp and custom IIsCheckedOutRsp interfaces. For more information about working with command and response components and their COM interfaces, see Command and Response components.
NOTE The IsCheckedOut command does not invoke a graphical user interface, it simply determines if a specified object store item is checked-out by the current user.
DLL | FnAppIntIsCheckedOutCmd.dll |
See Also | CheckoutList command |
The IsCheckedOut command uses the following interfaces:
Interface | Description |
---|---|
IIsCheckedOutCmd |
This is a custom interface used to initialize the data contained in the IsCheckedOut command component. The client application uses this interface to specify the object store item, for which to determine if it is checked out by the current user. |
IIsCheckedOutRsp |
This is a custom interface for the IsCheckedOut response component that is returned when the IsCheckedOut command is executed. This interface enables the client application to determine whether the specified item is in fact checked out by the current user. |
IAppIntCmd |
This is a standard interface which is automatically used by the IsCheckedOut command to invoke the IsCheckedOut command component. The client application executes the IsCheckedOut command by calling this interface and passing the AppIntSession component on which the IsCheckedOut command component is invoked. Each time the command is executed, an IsCheckedOut response component is returned. |
IAppIntRsp |
This is a standard interface that is automatically used by the IsCheckedOut command to determine the success or failure of the command, as well as retrieve any error code or messages. |
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\FnAppIntIsCheckedOutCmd.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 IsCheckedOut command component IIsCheckedOutCmdPtr spIIsCheckedOutCmd;
hResult = spIIsCheckedOutCmd.CreateInstance(__uuidof(IsCheckedOutCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the IsCheckedOut 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 IsCheckedOut command component with // the object store item, for which to determine // if it is checked out by the current user. std::cout << "Initializing the IsCheckedOut command component..." << std::endl; spIIsCheckedOutCmd->Initialize(pIObjectStoreItem); // Execute the IsCheckedOut command and capture the response component std::cout << "Executing the IsCheckedOut command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spIIsCheckedOutCmd);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);// Determine if the command failed, before accessing response component data hResult = spIAppIntRsp->GetHResult(); if (FAILED(hResult)) { std::cout << "The IsCheckedOut 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 IsCheckedOut 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; // Obtain the specific response information contained in the custom IsCheckedOut component IIsCheckedOutRspPtr spIIsCheckedOutRsp(spIAppIntRsp);
_ASSERTE(spIIsCheckedOutRsp != 0); // Determine if the object store item is checked out by the current user. std::cout << "Determing if object store item is checked out by the current user..." << std::endl; VARIANT_BOOL bIsCheckedOut = spIIsCheckedOutRsp->GetIsCheckedOut(); if (bIsCheckedOut == VARIANT_TRUE) { std::cout << "Item IS checked-out by the current user." << std::endl; } else {
std::cout << "Item IS NOT checked-out by the current user." << std::endl; } }} catch(...) { }