我找不到任何解决方案来使用SOAP API正确列出所有公用文件夹邮箱和公用文件夹。我发现只有powershell命令或C#方法。如果有人知道如何获取/列出所有公用文件夹,请向我提供解决方案。
答案 0 :(得分:1)
要枚举公用文件夹,您需要使用FindFolder操作,然后对从根目录开始的每个文件夹级别进行浅遍历查询(因为您无法进行深层遍历),例如
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<FindFolder Traversal="Shallow" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<FolderShape>
<t:BaseShape>Default</t:BaseShape>
</FolderShape>
<ParentFolderIds>
<t:DistinguishedFolderId Id="publicfoldersroot"/>
</ParentFolderIds>
</FindFolder>
</soap:Body>
</soap:Envelope>
您无法使用EWS获得公用文件夹邮箱,而在Office365上应该做的就是发现正确的PublicFolder邮箱要包含在路由标题中,因此您应该通读https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-route-public-folder-hierarchy-requests和https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-route-public-folder-content-requests(两者都有您需要的呼叫的XML示例。)
答案 1 :(得分:0)
首先,您需要使用SOAP确定X-AnchorMailbox标头的值,并发出自动发现请求以确定X-PublicFolderInformation值。
其次,使用FindFolder
,然后从Root开始遍历每个文件夹级别的遍历查询,例如:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:FindFolder Traversal="Shallow">
<m:FolderShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:FolderShape>
<m:IndexedPageFolderView MaxEntriesReturned="1" Offset="0" BasePoint="Beginning" />
<m:Restriction>
<t:IsEqualTo>
<t:FieldURI FieldURI="folder:DisplayName" />
<t:FieldURIOrConstant>
<t:Constant Value="My Public Contacts" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
</m:Restriction>
<m:ParentFolderIds>
<t:FolderId Id="AQEuAAADy/LIWjRCp0GFb0W6aGPbwwEARg5aCLUc8k6wLfl1c0a/2AAAAwIAAAA=" ChangeKey="AQAAABYAAABGDloItRzyTrAt+XVzRr/YAABdo/XB" />
</m:ParentFolderIds>
</m:FindFolder>
</soap:Body>
</soap:Envelope>
引用来自: