About: Office 365 REST APIs for Exchange

API Type:  Mailbox Assessor API Interface: REST, JSON, OAuth v2 over HTTP Business Logic: Works with content in mailboxes such as Mail, Calendar, Contacts Development Languages: Anything which can send a post. So, you can write code for iOS, Droid, Windows forms, ASP.NET, JavaScript, PowerShell…  Property Access: Yes Product Versions: Exchange Online (Wave 15+)  Summary:…

1

Howto: Example to retrieve the body property of a message using the Exchange Managed API.

          public string GetItemMime(ItemId oItemId)         {             string sReturn = string.Empty;             PropertySet oMimePropertySet = new PropertySet(ItemSchema.MimeContent);             Item oItem = Item.Bind(_ExchangeService, oItemId, oMimePropertySet);             return   oItem.MimeContent.ToString() ;                      }           public string GetItemMime(Item oItem)         {             PropertySet oMimePropertySet = new PropertySet(ItemSchema.MimeContent);             oItem.Load(oMimePropertySet);             return oItem.MimeContent.ToString();           }

2

Howto: Example to retrieve the html body property of a message using the Exchange Managed API.

        public string GetMessageBodyAsHtml(Item oItem)         {             string sRet = string.Empty;               PropertySet oPropSet = new PropertySet(PropertySet.FirstClassProperties);             oItem.Load(PropertySet.FirstClassProperties);               PropertySet oPropSetForBodyText = new PropertySet(PropertySet.FirstClassProperties);             oPropSetForBodyText.RequestedBodyType = BodyType.HTML;             oPropSetForBodyText.Add(ItemSchema.Body);             Item oItemForBodyText = Item.Bind((ExchangeService)oItem.Service, oItem.Id, (PropertySet)oPropSetForBodyText);             oItem.Load(oPropSetForBodyText);             sRet = oItem.Body.Text;             return sRet;         }

1

Howto: Example to retrieve the body property of a message using the Exchange Managed API.

        public string GetMessageBody(Item oItem, BodyType oBodyType)         {             string sRet = string.Empty;               PropertySet oPropSet = new PropertySet(PropertySet.FirstClassProperties);             oItem.Load(PropertySet.FirstClassProperties);               PropertySet oPropSetForBodyText = new PropertySet(PropertySet.FirstClassProperties);             oPropSetForBodyText.RequestedBodyType = oBodyType;             oPropSetForBodyText.Add(ItemSchema.Body);             Item oItemForBodyText = Item.Bind((ExchangeService)oItem.Service, oItem.Id, (PropertySet)oPropSetForBodyText);             oItem.Load(oPropSetForBodyText);             sRet = oItem.Body.Text;                         return sRet;         }

0

Why can't WebDAV read BCC?

Using WebDAV to read BCC information on messages (even in the Drafts folder) will not work. The “urn:schemas:mailheader:bcc” will not return the BCC information using WebDAV – this is expected behavior.  If you do a GET against the message to get the MIME, then you will also not get the BCC  – this also expected…

1

Howto Add an Attachment with Webdav

There is no mechanism to add an attachment in WebDAV.  You will need to create/recreate the item using a WebDAV PUT.  The text you would be putting would be the mime of the item, which also contains the attachment. It’s useful here to use CDOSYS to create a message and add an attachment – then…

5

HOWTO: Send Email With Attachment Using VB and WebDAV

To send an email with WebDAV, you will you will need to create/recreate the item with a WEBDAV PUT using the MIME of the message.  It gets tricky when working with attachments.  To get around the complexity of sending an email with an attachment, you may want to look at using CDOSYS to build the…

5

Howto: WebDAV SEARCH using C#

‘ This example shows how to do a SEARCH using C# // C# Example to SEARCH a mailbox.// TODO://   Add a button and double click on it//   Add a multi-line text box and make it big.//   Add a project reference to System.Xml, an System.Net//   Paste-in the code below//   Do the TODO sections in the code….

2

Howto: WebDAV PROPFIND using VB.NET

‘ This example shows how to do a PROPFIND using VB.NET ‘ VB.NET PROPFIND‘ TODO: Create a VB.NET winform with a button and a big multiline text box‘ TODO: Add references to System.Web, System.XML and System.IO‘ TODO: Add the code to the form.‘ TODO: Do the TODO sections in the code. Imports System.NetImports System.WebImports System.IO…

2

Howto: WebDAV X-MS-ENUMATTS using VBScript to enumerate attachments

‘ This example shows how to enumerate attachments on a message.  X-MS-ENUMATTS will ‘ return phantom urls to attachments on the message.  These URLs can be used with GET ‘ and DELETE (starting with Exchange 2003 SP1).  ‘ For listing and reading an attachment, you will first need to get a list of attachments ‘…

3