First-time poster, long-time fan and lurker. I turn to you for your sage advice and guidance.
I’m attempting to use EWS Manged API via PowerShell to programmatically schedule server downtime and ticket generation.
I am successfully able to output basic Appointment information (Subject, Start, End, Location). However, when trying to capture the text in the actual “Body” of the appointment, I keep getting blank output. I know that the appointment Body is not blank, and that my permissions are correct. I’m sure it’s just me attempting to access that property incorrectly, as my experience with EWS is very limited.
I’ve never used that API (but have connected to many others), but you should be able to what is available using basic Powershell commands. My next steps would be something like:
$appt = $Folder.FindAppointments($View2)
$appt.GetType() #see what data type the API is returning. API typically going to return XML\JSON
$appt | Get-Member -Force #see the available properties of that object
$appt. #Let Intellisense tell you what properties are available with dot notation.
I did see this code out there that searches appointments and returns data, which I didn’t see a call to .FindAppointments, so you may want to review this code to see if you are parsing the correct data:
Thanks much for the tips, Rob! Definitely good breadcrumbs to follow.
I had a look at the link you attached, and the script does not seem to be accessing the appointment body at all.
I agree with you that I may not be parsing the correct data. Perhaps the Body of the appointment is actually contained in another Item or Schema. I’ve done some exploration using the Get-Member -Force and Dot-Notation IntelliSense, but I’m still not seeing any Body field with content. I’ve looked at the members of Microsoft.Exchange.WebServices.Data.Appointment and Microsoft.Exchange.WebServices.Data.AppointmentSchema. I see reference to the properties TextBody, UniqueBody, and NormalizedBody as well. However, when attempting to select for these, they also come up blank.
I’ll keep hunting. I’m still learning, and sorry if some of this is obvious to someone that’s not a novice. Please let me know if anyone can help shed some light, or has experience with EWS API and PowerShell. I am always in awe of the PoSh Community and great input!
Just wanted to update this post with my solution, in case it helps someone in future. Much thanks to Rob above, as well as Glen Sales for his wonderful Exchange Blog (http://gsexdev.blogspot.ca/).
The solution was provided via Glen’s blog, where he details the LoadItemsFromProperties method for accessing appointment details such as Recipients and Body. These are not accessible via the FindAppointments method, as I used earlier. I thus created a new view with an additional PropertySet.