none
create an appointment on an Office365 group calendar programmatically RRS feed

  • Question

  • 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). 

    And OWA:

     

    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": "jjj",
    "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?  


    dwdwd

    Thursday, April 11, 2019 6:31 AM