更新事件不适用于 EWS 访问被拒绝

Update event does not work with EWS Access Denied

我正在使用 EWS 从应用程序创建会议。肥皂请求

{  
   "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"
}

我也在尝试通过应用程序编辑会议持续时间,它也工作正常。使用 SOAP 请求:

{  
   "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"
}

问题开始于我使用 Exchange Web 界面从 outlook.office.com 创建会议时。我收到错误消息:

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

除了更改密钥外,SOAP 请求是相同的。我已经阅读了一些类似的问题,这可能是由于日历上的权利引起的。我不是很清楚。

能否请教一下这个问题。

编辑:

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

您的冒充 header 可能是您尝试访问的邮箱 test007,或者只是您使用的服务帐户?

我建议您使用 PrimarySMTPAddress 来确保您指定的是要访问的邮箱而不是用户,例如

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

还有当你说

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

您的意思是您在 Outlook Web App 或您的代码中遇到错误?

干杯 格伦