Featured Post

How the Sumatra Double-Booking cmdlet works

First: you can always get help at the PowerShell prompt with: get-help Get-suDoubleBookedMeetings Let's say that we have the followin...

Thursday, December 09, 2010

EWS, Outlook Live, Exchange Release Levels, OWA, and WTF?

Come with us on a journey to mystery.

The subject started out as Holidays but morphed into the more general one of All Day Events (ADEs).

Using EWS, it is possible to insert ADEs and we do LOTS of them in the course of a migration.
BUT, some combination of EWS, Exchange release levels, and OWA are currently giving our usually stable process conniption fits.

Start off with inserting an ADE under either Exchange 2007 rules (with deprecated Time Zone, rules, but bear with us for a moment here) into Live@Edu (not that we have a client trying to do this exactly now or anything like that).

In Outlook attached to Live @ Edu they will appear correctly (as below) if you specify Exchange 2007 SP1. But it will appear as a two day banner if you specify Exchange 2010.

JUST to keep thing really really interesting, viewing the EXACT SAME ADEs in OWA shows the 2007 SP1-defined ADE showing up correctly, and the 2010-defined ADE spanning THREE days:

If your head does not hurt you have not been paying attention.
SO, for the time being while running a holiday insertion with our tools, specify Exchange 2007 SP1. Everything will be hunky-dory.

Don't believe us? Here's the VB .net code (we use Exchange Web Services Managed API v1.1. )

Public Function ewsBuildAllDayEvent() As String

Try

Dim myUserEmail As String = "user10@test.com"
Dim myEWSURL As String = "https://sn1prd0202.outlook.com/EWS/Exchange.asmx"
Dim myExchangeVersion As ExchangeVersion = ExchangeVersion.Exchange2007_SP1
Dim myLogon As String = "admin@test.com"
Dim myPassword As String = "Gu3ssWh0"
'create Service
service = New ExchangeService(myExchangeVersion)
service.Url() = New Uri(myEWSURL)
service.Credentials = New WebCredentials(myLogon, myPassword)
service.ImpersonatedUserId = New ImpersonatedUserId(ConnectingIdType.SmtpAddress, myUserEmail)
'build appointment
Dim appointment = New Microsoft.Exchange.WebServices.Data.Appointment(service)
appointment.subject = "MyTestADE"
appointment.Start = CDate(Now.ToShortDateString)
appointment.End = CDate(DateAdd(DateInterval.Day, 1, Now))
If myExchangeVersion = ExchangeVersion.Exchange2007_SP1 Then
appointment.StartTimeZone = System.TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
Else
appointment.StartTimeZone = System.TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
appointment.EndTimeZone = System.TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
End If
appointment.LegacyFreeBusyStatus = LegacyFreeBusyStatus.Busy
appointment.isalldayevent = True
appointment.Save(SendInvitationsMode.SendToNone)
Return "OK"

Catch ex As Exception
Return ("ERROR: " & ex.Message)
End Try

End Function

No comments: