CAUTION In FileNet P8 3.5.0 and later, the SelectObject command has been modified as follows:
The SelectObject command guides the user through the FileNet Workplace Select Item Java™Server Pages (JSP) pages, to enable the user to select a particular version of an object store item. Unlike the Open command, the SelectObject command does not prompt the user to determine if a subsequent checkout or download operation is to be performed on the selected item, it simply returns the item selected by the user. The client application must use the ISelectObjectCmd2 interface to filter the list of selectable items that are presented to the user based on object type and MIME type, as well as to customize the visible tabs and title for the page.
After the SelectObject command has been executed by calling IAppIntCmd::Invoke, a pointer to the selected item is returned in the SelectObject response component. Client applications may interact with the response component via the standard IAppIntRsp, as well as the custom ISelectObjectRsp and ISelectObjectRsp2 interfaces. For more information about working with command and response components and their COM interfaces, see Command and Response components.
DLL | FnAppIntSelectObjectCmd.dll |
See Also | Open command |
The SelectObject command implements the following interfaces:
Interface | Description |
---|---|
ISelectObjectjCmd |
This interface is deprecated in FileNet P8 3.5.0 and later. Customers should use ISelectObjectjCmd2 instead. |
ISelectObjectjCmd2 |
This is a custom interface used to initialize the data contained in the SelectObject command component. The client application can use the methods in this interface to customize the JSP page, including filtering the list of selectable items by object type and MIME type, as well as specifying the visible tabs and title for the page. |
ISelectObjectRsp |
This is a custom interface for the SelectObject response component that is returned when the SelectObject command is executed. This interface enables the client application to obtain the name, object store, and specified version for the item selected by the user. |
ISelectObjectRsp2 |
This is a custom interface for the SelectObject response component that is returned when the SelectObject command is executed. This interface enables the client application to obtain the MIME type of the item that was selected by the user. |
IAppIntCmd |
This is a standard interface which is automatically used by the SelectObject command to invoke the SelectObject command component. The client application executes the SelectObject command by calling this interface and passing the AppIntSession component on which the SelectObject command component is invoked. Each time the command is executed, an SelectObject response component is returned. |
IAppIntRsp |
This is a standard interface that is automatically used by the SelectObject 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\FnAppIntSelectObjectCmd.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 SelectObject command component ISelectObjectCmd2Ptr spISelectObjectCmd2;
hResult = spISelectObjectCmd2.CreateInstance(__uuidof(SelectObjectCmd));
if (FAILED(hResult)) {
std::cout << "Could not create the SelectObject command component.\n"; _ASSERTE(0);
} // Create the list of allowable MIME types const DWORD cNumElements = 4; long lCount = 0; COleSafeArray saMIMETypes(VT_BSTR, cNumElements); {
long lIndex = 0;
_bstr_t bstrWordMimeType(_T("application/msword"));
saMIMETypes.PutElement(&lCount, bstrWordMimeType.copy()); lIndex++;
_bstr_t bstrExcelMimeType(_T("application/vnd.ms-excel"));
saMIMETypes.PutElement(&lCount, bstrExcelMimeType.copy()); lIndex++;
_bstr_t bstrPPTMimeType(_T("application/vnd.ms-powerpoint"));
saMIMETypes.PutElement(&lCount, bstrPPTMimeType.copy()); lIndex++;
_bstr_t bstrTextMimeType(_T("text/plain"));
saMIMETypes.PutElement(&lCount, bstrTextMimeType.copy());
} _variant_t vMIMETypes((LPCVARIANT) saMIMETypes); // Initialize the custom SelectObject command component with the // page title, supported object and MIME types, and display the Search Tab. _bstr_t bstrPageTitle = (_T("Customized SelectObject Operation")); SelectItemMode enMode = eFoldersAndDocumentsMode; ShowTabsMode enTabs = eTabSearch; std::cout << "Initializing the SelectObject command component..." << std::endl; spISelectObjectCmd2->Initialize2(bstrPageTitle, enMode, enTabs, vMIMETypes); // Execute the SelectObject command and capture the response component std::cout << "Executing the SelectObject command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spISelectObjectCmd2);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);// Determine if the command failed, before accessing response component data hResult = spIAppIntRsp->GetHResult(); if (FAILED(hResult)) { std::cout << "The SelectObject 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 SelectObject command succeeded." << std::endl; // Obtain the information contained in the custom SelectObjectRsp component ISelectObjectRspPtr spISelectObjectRsp(spIAppIntRsp);
_ASSERTE(spISelectObjectRsp != 0); std::cout << "Details for the item selected by the user:<< std::endl; std::cout << "FileName=" << (LPCSTR) spISelectObjectRsp->GetItemName() << std::endl; std::cout << "Hyperlink=" << (LPCSTR) spISelectObjectRsp->GetHyperlink() << std::endl; // Obtain the information contained in the custom SelectObjectRsp2 component ISelectObjectRsp2Ptr spISelectObjectRsp2(spIAppIntRsp);
_ASSERTE(spISelectObjectRsp2 != 0); std::cout << "MIMEType=" << (LPCSTR) spISelectObjectRsp2->GetMimeType() << std::endl; // Display the information about the selected ObjectStoreItem IObjectStoreItemPtr spIObjectStoreItemSelected = spISelectObjectRsp->GetObjectStoreItem(); _ASSERTE(spIObjectStoreItemSelected != 0); std::cout << "ObjectStoreName=" << (LPCSTR) spIObjectStoreItemSelected->GetObjectStoreName() << std::endl; std::cout << "ItemType=" << (LPCSTR) CItemTypeConverter::EnumToBSTR(spIObjectStoreItemSelected->GetItemType()) << std::endl; std::cout << "VersionSeriesID=" << (LPCSTR) spIObjectStoreItemSelected->GetVersionSeriesID() << std::endl; std::cout << "VersionID=" << (LPCSTR) spIObjectStoreItemSelected->GetVersionID() << std::endl;} ...