Я хочу получить доступ к папкам и сообщениям в почтовом ящике унифицированной группы Office 365 (он-лайн диалоги) с помощью управляемого API-интерфейса SOAP EWS, но не могу найти к нему доступ.
Я попытался получить доступ кКорневая папка почтового ящика с двумя адресами, полученными https://graph.microsoft.com/v1.0/groups/<group-id>?$select=proxyAddresses, с префиксами SPO: и SMTP: и без них, но ни один из них не работал.
https://graph.microsoft.com/v1.0/groups/<group-id>?$select=proxyAddresses
Запрос был в следующем формате:
<?xml version="1.0"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"> <soap:Header> <t:RequestServerVersion Version="Exchange2013"/> <t:ExchangeImpersonation> <t:ConnectingSID> <t:SmtpAddress>group-name@tenant-name.onmicrosoft.com</t:SmtpAddress> </t:ConnectingSID> </t:ExchangeImpersonation> </soap:Header> <soap:Body> <GetFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <FolderShape> <t:BaseShape>Default</t:BaseShape> <t:AdditionalProperties> <t:FieldURI FieldURI="folder:ParentFolderId"/> </t:AdditionalProperties> </FolderShape> <FolderIds> <t:DistinguishedFolderId Id="root"/> </FolderIds> </GetFolder> </soap:Body> </soap:Envelope>
и это сообщение об ошибке:
<?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <s:Fault> <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorNonExistentMailbox</faultcode> <faultstring xml:lang="en-US">The SMTP address has no mailbox associated with it.</faultstring> <detail> <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorNonExistentMailbox</e:ResponseCode> <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The SMTP address has no mailbox associated with it.</e:Message> <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <t:Value Name="SmtpAddress">group-name@tenant-name.onmicrosoft.com</t:Value> </t:MessageXml> </detail> </s:Fault> </s:Body> </s:Envelope>
Не уверен, что есть лучшие методы, но выбор обычного пользователя Office 365 для олицетворения и указание API открыть почтовый ящик другого адреса электронной почты работает:
<?xml version="1.0"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"> <soap:Header> <t:RequestServerVersion Version="Exchange2013"/> <t:ExchangeImpersonation> <t:ConnectingSID> <t:SmtpAddress>user@tenant-name.onmicrosoft.com</t:SmtpAddress> </t:ConnectingSID> </t:ExchangeImpersonation> </soap:Header> <soap:Body> <GetFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <FolderShape> <t:BaseShape>Default</t:BaseShape> <t:AdditionalProperties> <t:FieldURI FieldURI="folder:ParentFolderId"/> </t:AdditionalProperties> </FolderShape> <FolderIds> <t:DistinguishedFolderId Id="inbox"> <t:Mailbox> <t:EmailAddress>group-name@tenant-name.onmicrosoft.com</t:EmailAddress> </t:Mailbox> </t:DistinguishedFolderId> </FolderIds> </GetFolder> </soap:Body> </soap:Envelope>