更新事件不适用于EWS Access Denied

时间:2016-03-02 13:28:46

标签: soap exchange-server exchangewebservices access-rights

我正在使用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网络界面从outlook.office.com创建会议时。消息收到错误:

  

访问被拒绝。检查凭据,然后重试。,无法从中获取ID   名。

除了更改密钥之外,SOAP请求是相同的。我读过一些类似的问题,可能是由于日历上的权利所致。我对此并不十分清楚。

你能否就这个问题提出建议。

编辑:

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

1 个答案:

答案 0 :(得分:1)

您的模拟标题可能是test007您尝试访问的邮箱,还是您正在使用的服务帐户?

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

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

当你说

  
    

问题出现的地方是,当我使用Exchange网络界面从outlook.office.com创建会议时。我收到错误信息

  

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

干杯 格伦