0

I am creating Meeting from application using EWS. With soap request

{  
   "body":{  
      "m:CreateItem":{  
         "attributes":[  
            {  
               "SendMeetingInvitations":"SendToAllAndSaveCopy"
            }
         ],
         "m:Items":[  
            {  
               "t:CalendarItem":{  
                  "t:Subject":"Booked from application",
                  "t:Body":{  
                     "attributes":[  
                        {  
                           "BodyType":"Text"
                        }
                     ],
                     "value":"Meeting body"
                  },
                  "t:Start":"2016-03-02T13:11:59+00:00",
                  "t:End":"2016-03-02T13:45:00+00:00",
                  "t:Location":"room1",
                  "t:RequiredAttendees":[  
                     {  
                        "t:Attendee":{  
                           "t:Mailbox":{  
                              "t:EmailAddress":"room1@testdomain.onmicrosoft.com"
                           }
                        }
                     }
                  ]
               }
            }
         ]
      }
   },
   "headers":{  
      "Authorization":"Basic somestringsdafsdfsdfsdfsdfsf"
   },
   "additionalNamespaces":[  
      "xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\"",
      "xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\""
   ],
   "soapHeader":{  
      "t:ExchangeImpersonation":{  
         "t:ConnectingSID":{  
            "t:PrincipalName":"test007@testdomain.onmicrosoft.com"
         }
      }
   },
   "method":"POST",
   "url":"https://outlook.office365.com/EWS/Exchange.asmx"
}

I am also trying to edit the meetings duration via application and it works fine also. With SOAP request:

{  
   "body":{  
      "m:UpdateItem":{  
         "attributes":[  
            {  
               "SendMeetingInvitationsOrCancellations":"SendToAllAndSaveCopy"
            },
            {  
               "MessageDisposition":"SaveOnly"
            },
            {  
               "ConflictResolution":"AlwaysOverwrite"
            }
         ],
         "m:ItemChanges":{  
            "t:ItemChange":{  
               "t:ItemId":{  
                  "attributes":[  
                     {  
                        "Id":"AAApAHJvb20xQGNlcnR1c2ludGVybmF0aW9uYWwub25taWNyb3NvZnQuY29tAEYAAAAAAMWslF/s3JlHvuBz+Grw4nkHAMq37IYLqfhKh5oHo2fodacAAAAAAQ0AAMq37IYLqfhKh5oHo2fodacAAFweeHQAAA=="
                     },
                     {  
                        "ChangeKey":"DwAAABYAAADKt+yGC6n4SoeaB6Nn6HWnAABcIvBS"
                     }
                  ]
               },
               "t:Updates":{  
                  "t:SetItemField":{  
                     "t:FieldURI":{  
                        "attributes":[  
                           {  
                              "FieldURI":"calendar:End"
                           }
                        ]
                     },
                     "t:CalendarItem":{  
                        "t:End":"2016-03-02T15:00:00+00:00"
                     }
                  }
               }
            }
         }
      }
   },
   "headers":{  
      "Authorization":"Basic somestringssdasasfasfasfasfaf"
   },
   "additionalNamespaces":[  
      "xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\"",
      "xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\""
   ],
   "soapHeader":{  
      "t:ExchangeImpersonation":{  
         "t:ConnectingSID":{  
            "t:PrincipalName":"test007@testdomain.onmicrosoft.com"
         }
      }
   },
   "method":"POST",
   "url":"https://outlook.office365.com/EWS/Exchange.asmx"
}

Where problems starts is, when I create meeting from outlook.office.com using Exchange web interface. I get error with message:

Access is denied. Check credentials and try again., Cannot get ID from name.

The SOAP request is the same except change keys. I have read on some similar problems that it might be due to the rights on calendar. I am not quite clear with that.

Could you please advise on this problem.

EDIT:

{  
   "t:ExchangeImpersonation":{  
      "t:ConnectingSID":{  
         "t:PrimarySmtpAddress":"test007@testdomain.onmicrosoft.com"
      }
   }
}
eomeroff
  • 9,599
  • 30
  • 97
  • 138

1 Answers1

1

It maybe your impersonation header is test007 the Mailbox your trying to access or just the service account your using ?

I'd suggest you use the PrimarySMTPAddress to ensure you are specifying the Mailbox to access rather then a user eg

      "t:ExchangeImpersonation":{  
     "t:ConnectingSID":{  
        "t:PrimarySmtpAddress":"test007@testdomain.onmicrosoft.com"
     }

Also when you say

Where problems starts is, when I create meeting from outlook.office.com using Exchange web interface. I get error with message

Do you mean you get the error in the Outlook Web App or in your code ?

Cheers Glen

Glen Scales
  • 20,495
  • 1
  • 20
  • 23
  • The problem is in my app, when trying to update meeting that is created via outlook. Meetings created throughout my app can be updated with out error. Thank you. – eomeroff Mar 03 '16 at 07:59
  • That sounds like you trying to update an Appointment than that your code isn't the owner of that why using the PrimarySMTP is a better idea, in a shared Mailbox situation you may need to look at the Organizer of the Appointment and then Impersonate the specific Organizer. – Glen Scales Mar 03 '16 at 08:19
  • Please check my edit. It reports the same error with change that you suggested. Thank you. – eomeroff Mar 03 '16 at 10:17
  • I think that I might have idea why this is not working. Can you please check my last edit. Thank you. – eomeroff Mar 03 '16 at 11:20