Checkin Command

CAUTION Customers should only use the ICheckinCmd2 interface in new development, as well as replace existing implementations of the ICheckinCmd interface with ICheckinCmd2.

The Checkin command launches the FileNet Workplace Checkin Wizard, which guides the user through the process of checking an item into an object store. If you would prefer to allow the user to quickly checkin an item without using the FileNet Workplace Checkin Wizard, use the QuickCheckin command instead of Checkin.

The client application must use the ICheckinCmd2 interface to specify the item to checkin. Once the user has completed the Checkin operation, an IObjectStoreItem interface is returned which may be queried to obtain a pointer to the added checked-in item. The client is responsible for deleting the local file, if desired.

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

Reference

DLL FnAppIntCheckinCmd.dll
See Also

CheckoutList, CancelCheckout , and QuickCheckin commands

Interfaces

The Checkin command uses the following interfaces:

Interface Description
ICheckinCmd

This interface is deprecated in FileNet P8 3.5.0 and later. Customers should use ICheckinCmd2 instead.

ICheckinCmd2

This is a custom interface used to initialize the data contained in the Checkin command component. The client application can use the methods in this interface to identify the item to check-in by specifying the name and directory location of the file on the local machine, the version object for the item, the XML for the item properties, as well as to customize the dialog title.

ICheckinRsp

This is a custom interface for the Checkin response component that is returned when the Checkin command is executed. This interface enables the client application to obtain information about the item that was checked into the object store.

IAppIntCmd

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

IAppIntRsp

This is a standard interface that is automatically used by the Checkin 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\FnAppIntCheckinCmd.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 Checkin command component ICheckinCmd2Ptr spICheckinCmd2;
hResult = spICheckinCmd2.CreateInstance(__uuidof(CheckinCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the Checkin command component.\n"; _ASSERTE(0);
} // 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 Checkin 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; VARIANT_BOOL bDeclareRecordOn = VARIANT_FALSE;
_variant_t vDocumentIDs(); std::cout << "Initializing the Checkin command component..." << std::endl; spICheckinCmd2->Initialize2(bstrDialogTitle, bstrPathName, spIObjectStoreItem, bstrRootDocClass, bRestrictClass, bstrPropertiesXml, bDeclareRecordOn, vDocumentIDs); // Execute the Checkin command and capture the response component std::cout << "Executing the Checkin command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spICheckinCmd2);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);
// Determine if the command failed, before accessing response component data hResult = spIAppIntRsp->GetHResult(); if (FAILED(hResult)) { std::cout << "The Checkin 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 Checkin 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 CheckinRsp component ICheckinRspPtr spICheckinRsp(spIAppIntRsp);
_ASSERTE(spICheckinRsp != 0);
IObjectStoreItemPtr spIObjectStoreItemCheckedIn = spIAddRsp->GetObjectStoreItem();
_ASSERTE(spIObjectStoreItemCheckedIn != 0);
std::cout << "ObjectStoreName=" << (LPCSTR) spIObjectStoreItemCheckedIn->GetObjectStoreName() << std::endl;
std::cout << "ItemType=" << (LPCSTR) CItemTypeConverter::EnumToBSTR(spIObjectStoreItemCheckedIn->GetItemType()) << std::endl;
std::cout << "VersionSeriesID=" << (LPCSTR) spIObjectStoreItemCheckedIn->GetVersionSeriesID() << std::endl;
std::cout << "VersionID=" << (LPCSTR) spIObjectStoreItemCheckedIn->GetVersionID() << std::endl; }
} catch(...) { }