RunCommand Method

The RunCommand method instructs the ExpressAddin component to execute a specified Application Integration command. Prior to calling RunCommand, the Startup method must be used to initialize the ExpressAddin component.

Usage
HRESULT hResult = spIExpressAddin->RunCommand(BSTR bstrCommand);
Parameters
bstrCommand - [in] Required BSTR, an input string which specifies the Application Integration command to execute. The following commands may be executed by specifying the corresponding input string:

Supported Command Input String
Add a Document
using the Add Wizard
ExpressAddin.AddDocumentUseAddWizard
Add a Document
using the Entry Template
ExpressAddin.AddDocumentSelectTemplate
Add a Folder
using the Add Folder Wizard
ExpressAddin.AddFolderUseAddWizard
Cancel a Checkout ExpressAddin.CancelCheckout
Checkin a Document
using the Checkin Wizard
ExpressAddin.CheckinDocumentUseCheckinWizard
Checkin a Document
using the Quick Checkin
ExpressAddin.CheckinDocumentQuickCheckin
Get Info ExpressAddin.GetInfo
Logoff ExpressAddin.Logoff
Open using My Checkouts ExpressAddin.OpenMyCheckouts
Open using Select Item ExpressAddin.SelectItem
Save Document ExpressAddin.Save
Show My Inbox Tasks ExpressAddin.TasksMyInbox
Insert > Insert a Hyperlink ExpressAddin.InsertHyperlink
Return
The return value from the RunCommand method should always be examined by the Add-In application. The following values may be returned:
- S_OK, the specified command was processed successfully.
- E_ABORT, the user cancelled execution of the command prior to completion.
- Other HRESULT values, another failure occurred. In these situations, an error message dialog is displayed with more information about the failure.
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 calls are made to the RunCommand method to execute the specified Application Integration commands:
   ...
   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;
         }
      ...
      return TRUE;
   }
   ...
   void AddinSampleDlg::OnFileNetOpenViaSelectItem()
   {
      HRESULT hResult = S_OK;
      try
      {
         // Run the "Open using Select Item" process.
         hResult = m_spIAddin->RunCommand( _bstr_t( _T( "ExpressAddin.OpenSelectItem" ) ) );
      }
      catch ( _com_error &err )
      {
         AfxMessageBox( err.ErrorMessage() );
}
catch( ... ) ... } ...
See Also
Startup Method
Shutdown Method