ISelectObjectCmd2::Initialize2

NOTE Customers should only use the ISelectObjectCmd2::Initialize2 method in new development, as well as replace existing implementations of ISelectObjectCmd::Initialize with ISelectObjectCmd2::Initialize2. The only difference between these methods is that a parameter has been added to support specification of the tabs for the Java™Server Pages (JSP) page.

The Initialize2 method customizes the Select Item JSP page in preparation for use by the SelectObject operation, by allowing the client application to filter the list of selectable items that are presented to the user (based on object type and MIME type), and to specify the tabs and title for the page

void spISelectObjectCmd2->Initialize2(_bstr_t bstrPageTitle,
                                      SelectItemMode enMode,
                                      showTabsMode enTabs,
                                      VARIANT vMimeTypes);
Parameters
bstrPageTitle - [in] Required _bstr_t, which specifies the label to display in the title bar of the Select Item JSP page when the SelectObject command is invoked. By using this parameter, client applications can customize the title that appears at the top of the JSP page to correspond with their application requirements.
enMode - [in] Required SelectItemMode enumeration, which specifies the selection mode for the SelectObject operation and can be set to the following:
- eFoldersAndDocumentsMode, select either a document or a folder.
- eDocumentsOnlyMode, select only a document.
- eFoldersOnlyMode, select only a folder.
- eAllObjectTypesMode, select any type of object, including documents and folders.
enTabs - [in] Required showTabsMode enumeration, which specifies the visible tabs on the Select Item JSP page for the SelectObject operation, and can be set to the following:
- eTabNone, do not display any additional tabs on the JSP page.
- eTabSearch, display the additional "Search" tab in the left bar of the JSP page. The Search tab enables users to view Search templates and execute them to locate objects in an Object Store.
vMimeTypes - [in] Required pointer to a VARIANT, which specifies a SAFEARRAY of the possible MIME types for which to generate the list of selectable items. When all MIME types are allowed, a value of VT_EMPTY should be specified.
Results
This method always returns an HRESULT value of S_OK if successful.
Sample
The following is a fragment from the complete example for the SelectObject command.
   ...
   // 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 SelectObject2 command and capture the response component std::cout << "Executing the SelectObject2 command..." << std::endl; IAppIntCmdPtr spIAppIntCmd(spISelectObjectCmd2);
IAppIntRspPtr spIAppIntRsp = spIAppIntCmd->Invoke(spIAppIntSession);
...