Best Practices: EWS Managed API coding for Exchange

There are issues which we seem to get a lot of cases on which are tied to the way a customer writes their code.  Often there are sections of code which were missing or that they otherwise should have implemented.  If your running into an issue or writing new code, then please read all points…

0

Sample: Use JavaScript with OOM to create an email with an attachment and display it in Outlook for sending.

This sample shows how OOM can be used with JavaScript from the command line. Use cscript to launch it – this will cause the script to write the output to the command window.   // Use this command line:  cscript test.js function test() { WScript.Echo(‘Start ————-‘); try { var outlook = new ActiveXObject(‘Outlook.Application’); var email = outlook.CreateItem(0);…

0

About: Messaging APIs

There are many different types of APIs which are focused on mailbox access, administration and care.  There are different ways to approach APIs when looking for one to use for your messaging project.  This article categorizes APIs by type.  Knowing the type of application is needed at the start will help guide you to picking…

0

Taking Dumps with the ADPlus executable

ADPlus from the Debugging Tools can be used to get Crash Dumps and Hang Dumps which would contain the most-needed information for debugging. It used to be a vbscript file which was used to attach the cdb debugger (cdb is a command line debugger). Now ADPLus is a managed code application. Because of this, the…

4

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

Howto: Read OOF info using EWS and VBScript against an Exchange 2010 SP1

‘ Here is a code sample showing how to read OOF info using EWS from VBScript against an Exchange 2010 SP1 box. Const strUrl = “https://mail.mycompanyetc.com/ews/exchange.asmx” ‘ TODO: Change Const strUser = “myuserid” ‘ TODO: Change Const strPass = “mypassword” Const strDom = “myusersdomain”  ‘ TODO: Change Const strEmailAddress = “myemailaddress@myemaildomain.com”  ‘ TODO: Change  …

0

Don’t redistribute product DLLs unless you know its safe and legal to do so.

Redistribution of files in the “C:\Program Files\Microsoft\Exchange Server” folder and sub-folders is not advised/supported.  Yes, this does include the “C:\Program Files\Microsoft\Exchange Server\Public” folder also.  These files are installed when the Exchange 2007 (or later) tools are installed.  If you need these files with the minimal installation, then use the Exchange installer to install them –…

2

Links on Common Exchange Web Services (EWS) Questions

I’ve put together a list of articles which cover common questions on Exchange Web Services (EWS).  These links cover issues from starting out to common problems.  I hope they help.  Please let me know if there is anything important to add.   Getting Started:     Web Services http://msdn.microsoft.com/en-us/library/aa579187(EXCHG.80).aspx   Exchange Web Services Architecture http://msdn.microsoft.com/en-us/library/aa579369(EXCHG.80).aspx…

2