title: Alternative to CommandBarControl for Outlook 2013 VSTO add-in
body: <p>I have a small VSTO add-in that I've used with Outlook 2010 for some time. A move to Office 2013/Outlook 2013 is soon happening and so the add-in needs to be re-written to work with Outlook 2013.</p>
  
  <p>The Outlook add-in is triggered by a custom ribbon button. When triggered, the add-in will create a new meeting request window and fill the message body with some custom content. After which the user can complete the meeting request and send it if they so desire.</p>
  
  <p>The issue I'm currently having is that previously, this message window was created using the CommandBarControl object to programmatically trigger a click of the "New Meeting" button in Outlook. This worked in previous versions of Outlook, <a href="http://msdn.microsoft.com/en-us/library/office/jj229903.aspx" rel="nofollow">but I gather that the CommandBarControl object has been removed from Outlook 2013</a> and now fails silently. This is indeed what I am seeing.</p>
  
  <p>The original code that was being used to create the new meeting request is this:</p>
  
  <pre><code>Explorer activeExplorer = Globals.ThisAddIn.Application.ActiveExplorer();
  
  CommandBarControl commandBarControl = activeExplorer.CommandBars.FindControl(Type.Missing, 1106);
  commandBarControl.Execute();
  
  appointmentItem = (AppointmentItem)Globals.ThisAddIn.Application.ActiveInspector().CurrentItem;
  appointmentItem.MeetingStatus = OlMeetingStatus.olMeeting;
  appointmentItem.RTFBody = message; // message is a byte array being passed in from elsewhere.
  </code></pre>
  
  <p>The FindControl() method is used to find the "New Meeting" button in Outlook and then Execute() a click action on that button.</p>
  
  <p>An alternative might be something like this:</p>
  
  <pre><code>appointmentItem = (AppointmentItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olAppointmentItem);
  appointmentItem.MeetingStatus = OlMeetingStatus.olMeeting;
  appointmentItem.RTFBody = message; // message is a byte array being passed in from elsewhere.
  appointmentItem.Display(false);
  </code></pre>
  
  <p>The second code block will also create a new meeting request window and works in Outlook 2013, however there are a couple of subtle but important differences with the second code block...</p>
  
  <ol>
  <li>The created meeting request will not inherit the date and time that a user has previously clicked on in their calendar, instead it will default to the current date/time regardless of what date/time the user has clicked on in their calendar.</li>
  <li>The created meeting request will not respect the situation where a user is creating a meeting request "on behalf of" another user, because it ignores which calendar has been clicked on before the user initiated the new meeting request.</li>
  </ol>
  
  <p>So my question is this: how can one now programmatically create (using a VSTO add-in) a new meeting request in Outlook 2013 that will respect which calendar the user has clicked on before hand? That is, it will satisfy the above two requirements that previously using the CommandBarControl object managed to satisfy?</p>