Oneliner Mailbox entry with Powershell in Alternate On-line utilizing the oData preview

Oneliner Mailbox entry with Powershell in Alternate On-line utilizing the oData preview

One of many issues that was introduced at MEC just lately was Microsoft’s Cloud first technique with Alternate, which principally implies that new characteristic will seem in Alternate On-line first after which at some later date make their means into the OnPremise model of Alternate. One in every of these new cloud first options is the OData API for Mailbox information which is a REST based mostly API for accessing mailbox information (as apposed to EWS which is a SOAP based mostly API for accessing mailbox information). JSON and REST have turn out to be the usual for constructing WebAPI’s over the previous few years and each man and his canine (Google, Fb,Twitter,Apple and so on) at the moment are utilizing this so its thrilling to see Alternate make this transfer.
If you wish to discover out extra about it and you’ve got a few hours to look at some good video’s I might verify the next two shows from MEC http://channel9.msdn.com/Occasions/MEC/2014/EXT301 and  http://channel9.msdn.com/Occasions/MEC/2014/EXT304 which provides you with a great grounding in each oData  and in addition the brand new consent framework which is vital in case your constructing fashionable apps. 
One of many attention-grabbing issues your can do with these REST API is utilizing the Invoke-RestMethod cmdlet in Powershell v4 is now get entry to Mailbox information with one line of code. Listed below are a number of samples to moist your urge for food and get you began (word this API remains to be in preview so that is topic to alter/errors and bugs)
Present Unread Inbox Messages

  1. Invoke-RestMethod -Uri “https://outlook.office365.com/ews/odata/Me/Inbox/Messages?`$filter=IsRead eq false” -Credential (get-credential) | foreach-object choose Topic  
Present Calendar Appointments for the following 7 days

  1. Invoke-RestMethod -Uri (“https://outlook.office365.com/ews/odata/Me/Calendar/Events?`$filter=Start le “ + (Get-Date).ToUniversalTime().AddDays(7).ToString(“yyyy-MM-ddThh:mm:ssZ”) + ” and End ge “ + (Get-Date).ToUniversalTime().ToString(“yyyy-MM-ddThh:mm:ssZ”)) -Credential (Get-Credential) | foreach-object{$_.Worth}  
Present Contacts

  1. Invoke-RestMethod -Uri “https://outlook.office365.com/ews/odata/Me/Inbox/Messages” -Credential (get-credential) | foreach-object{$_.worth}  
There are heaps extra instance of utilizing the brand new REST instructions at http://msdn.microsoft.com/en-us/library/workplace/dn605892(v=workplace.15).aspx

Leave a Reply