Skip to main content

Posts

Sending a Message via EWS from an Arduino MKR1000

The Internet of Things is all the rage these days and one of the most popular prototyping platform for any electronic projects these days is the Arduino. The new MKR1000 Arduino board combines the functionality from the Zero board with a WifiSheild on a compact board and pretty cheap $35. It looks like These boards are pretty cool and take you back in some ways to 80's with some of the programming challenges that come with memory restriction devices. Eg the MRK1000 has 32Kb of SRAM which is half that of Commodore 64 although it runs at 48Mhz vs the 1.33 Mhz the Commodore could manage (I know this isn't a fair technical comparison just trying provide a bit of contrast). The nice thing with this board also is because it implements a cryptoauthentication chip  it can do SSL communication which can be problem with low power boards because of the amount of processing power required for SSL. So at the bare bones this board can run c...

EWS Basics : Sending Messages using EWS

One of the most basic things you might want to do with EWS is Send a Message, while its may sound easy sending messages programmatically can be at times confusing. But first lets take one step back for a second from EWS and look at the different ways you could send Email programmatically on Exchange. SMTP : (Simple Mail Transfer Protocol) SMTP is the backbone protocol for Email and is how most Email is transferred between servers on the Internet. Its also the protocol POP and IMAP clients use to send email. Because SMTP is a protocol (meaning its a set of rules defined in a RFC) rather then an API  to use it you need to use a library that will give you some objects that you can code against that will then generated the necessary communication that follows the protocol rules. Some example of these are CDOSys, and System.NET.Mail. From an Exchange technical point of view when you submit a message via SMTP your submitting it directly into the Transport Pipeline so i...

Using the ExcludesBitmask SearchFilter\ Restriction in EWS

Complex properties are one of the more challenging elements when it comes to developing with Exchange and bitwise properties are one of the more challenging property types you may need to deal with. The most common bitwise property in Exchange you may access/use is the PR_MessageFlags property https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx  . If you look at this property on a Message that you received you might see something like What the  ExcludesBitmask SearchFilter/Restriction in EWS allows you to do is create a search where you can specifically exclude messages because they have one of these bitmask values set. Eg you might want to exclude Draft messages from your search or maybe you want to exclude any messages that where SentBy you in the Inbox. You can also use this Search Filter with the Not filter which Negates the restriction so if I created a Searchfilter to excluded all messages with the MSGFlag_HasAttached then negated that with ...

EWS Basics: Message Flagging and Marking Messages Read/Unread

Messages that are stored in Exchange can be flagged in a number of ways to indicate different states to the user or as an effective method to prompt the user to action (or make them remember to do something). Unread/Read Flags  The most commonly used Flag in Exchange is the Unread/Read Message flag which is used so when a message arrives in Mailbox a user can track which messages they have read. In EWS this flag is surfaced in the API in the form of a Strongly type property isRead   https://msdn.microsoft.com/en-us/library/office/bb408987(v=exchg.150).aspx  . (The underlying Store property that back this is PidTagMessageFlags property https://msdn.microsoft.com/en-us/library/ee160304(v=exchg.80).aspx   which is a bitwise flag representing many states of a message). The other place the Unread Message flag is surfaced is on the Folder object in the guise of the Unread Item count. So in the below example we Bind to Inbox folder and we...

Showing the client that was used to create or update an Appointment in Exchange 2013/16 using EWS

Previously I posted an example on Mining the Client information on Sent Messages in EWS to report on what client is being used in this post . For Calendar appointments there is a simular but different property that gets set when you either create or update a Appointment eg (This property is set by the Exchange Store based on what client is being used)  I've put together a script that aggregates this property and produces a summary report like Its also produces an export report of all the appointments that looks like the following so you can see at the appointment level what client is being used. I've put this script up on GitHub here https://github.com/gscales/Powershell-Scripts/blob/master/ShowCalendarClients.ps1

EWS Basics : Create a Folder in a Mailbox or Public Folder

One of the more common questions on EWS I get is around how to create a folder so this post will cover the basics you need to know around creating folders using EWS in Mailboxes or Public Folders. What you need to create a Folder To create a folder you first need a unique name for the new folder eg if you going to create a folder called "SubFolder1" under the Inbox another folder with the name Subfolder1 can't already exists as a SubFolder of the Inbox (anywhere else in the Mailbox is okay) if it does you will get an error.  So when writing a script to create a folder its first good to includes a search to see if the folder already exists. eg #Define Folder Veiw Really only want to return one object $fvFolderView = new-object Microsoft.Exchange.WebServices.Data.FolderView(1) #Define a Search folder that is going to do a search based on the DisplayName of the folder $SfSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqu...
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.