create an appointment on an Office365 group calendar programmatically

Copper Contributor

Hi All,

 

I am trying to create an appointment on an Office365 group calendar programmatically.  I am able to get it through Outlook for Windows/OWA (New UI). 

WeChat Screenshot_20190411140322.png

And OWA: WeChat Screenshot_20190411140724.png

 

i retrieve the appointment via MS Graph API :

"attendees": [],
"organizer": {
"emailAddress": {
"name": "test11appointment",
"address": "test11@haxia.onmicrosoft.com"
}

So i post the similar json body and want to create a group appointment via MS Graph API, but it will automatically include the event creator (the current sign-in user) as one attendee:

 

"attendees": [
{
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "test11appointment",
"address": "test11@haxia.onmicrosoft.com"
}
},
{
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "wyd",
"address": "jjj@haxia.onmicrosoft.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "test11appointment",
"address": "test11@haxia.onmicrosoft.com"
}
}

this will cause the event shows as a meeting instead of appointment. Then it will send invitations to group members, this annoyed me a lot.  

 

So I trace the log of Outlook for Windows/OWA (New UI).  i find that Outlook for Windows uses EWS to create appointments. i tried the following code :

ExchangeService exchService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
exchService.UseDefaultCredentials = false;
exchService.Credentials = new NetworkCredential("admin@o365domain.com", "pwd");
exchService.PreAuthenticate = false;
   
Appointment appointment = new Appointment(exchService);
// Set the properties on the appointment object to create the appointment.
appointment.Subject = "Sales Meeting";
appointment.Body = "Focus on pre-sale and marketing.";
appointment.Start = DateTime.Now.AddDays(2);
appointment.End = DateTime.Now.AddDays(2).AddHours(3);
appointment.Location = "Room 111";
appointment.ReminderMinutesBeforeStart = 240;
 
// Bind the specified group calendar folder.
Folder calendar_Folder = Folder.Bind(exchService, new FolderId(WellKnownFolderName.Calendar, "salesboard@o365domain.com"));
appointment.Save(calendar_Folder.Id, SendInvitationsMode.SendToNone);

 

Even though it could prevent sending invitations but it still will involve admin@o365domain.com as one attendee. 

 

As for the new OWA, i find it in fact use the following web service:

https://outlook.office365.com/owa/service.svc?action=.....

i did not find any docs about this service url.  Can someone help me?  

1 Reply

Hi @kong mengfei,

In my research on the net, I found xchange Web Services .NET Core API for Microsoft Exchange server and Office 365/Exchange Online. The API offers complete Exchange Web Services functionality including the ability to work with appointment. There are a number of use cases on the site and the API itself is well documented. Link is http://www.independentsoft.de/exchangewebservices/tutorial/createappointment.html