Startup Method

The Startup method initializes the ExpressAddin component with client application XML preference settings and creates the user's Application Integration session. All static, application-specific settings that will not change during application execution, such as the application name, should be specified in XML and transferred to the component through the use of this method, rather than through the event handling mechanism.

The client application may specify whether or not they would like to use the single unified login shared by the other FileNet Office Add-Ins by setting the bstrPreferencesXml parameter to useUnifiedLogin. When use of the unified login is implemented, the client application Add-In shares a single login with other FileNet Office AddIns, including Microsoft® Word, Excel, Outlook, and PowerPoint.

The client application may specify the allowable MIME types in the bstrPreferencesXml parameter. These MIME types are used to restrict the contents of lists displayed to the user by various FileNet Application Integration commands. For example, during execution of the Open command, the list of documents which can be selected by the user is restricted based on the specified MIME types.

Usage
HRESULT hResult = spIExpressAddin->Startup(BSTR bstrPreferencesXml);
Parameters
bstrPreferencesXml - [in] Required BSTR, the XML which specifies the static, application-specific preference settings. The following settings may be specified in the XML input string:
- applicationName, provides a name for the application.
- useUnifiedLogin, a value of true specifies that the application should use the single, shared unified FileNet Office Add-In login. A value of false indicates that the application will use a separate login for the session.
- applicationMimeTypes, identifies an array of MIME types supported by the application. The MIME types identified in this parameter will restrict the contents of lists displayed to the user.
Return
If the Startup method successfully initializes the ExpressAddin component, the method returns an HRESULT value of S_OK. When the XML input string cannot be properly parsed by the Express Add-In, a value of E_INVALIDARG is returned. If another type of error occurrs, the corresponding HRESULT failure value is returned.
Example
The following are fragments from the Add-In Sample Application, which demonstrates how to implement this method in C++. In the file AddInSampleAppDlg.cpp, the ExpressAddin component is instantiated and a call is made to the Startup method to configure the Add-In application:
   ...
   BOOL AddinSampleDlg::OnInitDialog()
   {
      CDialog::OnInitDialog();
      SetupDialog();
      try
      {
         // Initialize a smart pointer to the IExpressAddin interface.
         HRESULT hResult = m_spIAddin.CreateInstance( CLSID_ExpressAddin );
         if (FAILED(hResult))
         {
			return FALSE;
         }
         // Run the Startup() interface method.
         m_spIAddin->Startup(ComposeStartupXml());
      ...
      return TRUE;
   }
   ...
   _bstr_t AddinSampleDlg::ComposeStartupXml()
   {
      // Specify the startup XML for the ApplicationName,  
      // the ApplicationID, and the array of Application MimeTypes.
      _bstr_t startupXml = _T( "" );
      startupXml +=   _T("<?xml version=\"1.0\" ?>");
      startupXml +=   _T("<object key=\"addInConfiguration\" version=\"1.0\">");
      startupXml +=      _T("<setting key=\"applicationName\">AddinSampleApp</setting>");
      startupXml +=      _T("<setting key=\"useUnifiedLogin\">true</setting>");
      startupXml +=      _T("<array key=\"applicationMimeTypes\">");
      startupXml +=         _T("<value>text/xml</value>");
      startupXml +=         _T("<value>text/html</value>");
      startupXml +=         _T("<value>text/txt</value>");
      startupXml +=         _T("<value>text/plain</value>");
      startupXml +=         _T("<value>application/msword</value>");
      startupXml +=      _T("</array>");
      startupXml +=   _T("</object>");
      return startupXml;
   }
   ...
See Also
RunCommand Method
Shutdown Method