Search code examples
outlooktaskms-officeassignoffice-automation

Creating a Downloadable Microsoft Outlook Task


Is it possible to have a Microsoft Outlook task that a person could download from a website and open in Microsoft Outlook and then assign to another person?

When I've tried saving a task as a file it won't let me assign it when I open it.


Solution

  • You can create VBA macro or just automate Outlook from your application to get the job done. The Outlook object model provides all the necessary properties and methods for that.

    After an Outlook item is downloaded you can use the Application.CreateItemFromTemplate method which creates a new Microsoft Outlook item from an Outlook template (.oft) and returns the new item. New items will always open in compose mode, as opposed to read mode, regardless of the mode in which the items were saved to disk. Read more about that in the How To: Create a new Outlook message based on a template article.

    Also you can try using the OpenSharedItem method which opens a shared item from a specified path or URL. This method is used to open iCalendar appointment (.ics) files, vCard (.vcf) files, and Outlook message (.msg) files. The type of object returned by this method depends on the type of shared item opened, as described in the following table.

    Finally, keep in mind that Outlook is a singleton which means only one instance of the Outlook application can be run on the system. Whatever you run for opening in Outlook you can handle the NewInspector event which is fired when an item is opened in Outlook.