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



我正在使用 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"
}

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

{  
   "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 创建会议时。我收到错误消息:

访问被拒绝。请检查凭据并重试。, 无法从 获取 ID 名字。

除更改键外,SOAP 请求是相同的。我已经读过一些类似的问题,这可能是由于日历上的权利。我不太清楚。

您能否就此问题提供建议。

编辑:

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

也许您的模拟标头是您尝试访问的邮箱 test007 还是您正在使用的服务帐户?

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

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

另外当你说

问题开始的地方是,当我使用 Exchange Web 界面从 outlook.office.com 创建会议时。我收到消息错误

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

干杯幽谷

最新更新