【发布时间】:2016-07-13 09:48:29
【问题描述】:
我想通过 EWS 从 Exchange 服务器获取所有用户。我已经意识到可以按照答案here中的描述处理 FindPeople SOAP 请求
正如它在回答中所说,这需要 AddressListId。因此我不得不使用 PowerShell 在 Exchange 上创建 GlobalAddressList。
我在instructions之后创建了 GlobalAddressList
我不知道如何将用户添加到 GlobalAddressList 中?
列表中没有用户的事件我应该能够获得空列表吗?所以我尝试了。
这是请求:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<RequestServerVersion Version="Exchange2013_SP1" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<FindPeople xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<IndexedPageItemView MaxEntriesReturned="100" Offset="0" BasePoint="Beginning" />
<ParentFolderId>
<AddressListId Id="someId" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
</ParentFolderId>
</FindPeople>
</soap:Body>
</soap:Envelope>
上面的“someId”值是我创建的 GlobalAddressList 的 GUID。
这是我得到的错误响应。
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<s:Envelope
xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">
<s:Header>
<Action s:mustUnderstand=\"1\"
xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">*
</Action>
</s:Header>
<s:Body>
<s:Fault>
<faultcode
xmlns:a=\"http://schemas.microsoft.com/exchange/services/2006/types\">a:ErrorInternalServerError
</faultcode>
<faultstring xml:lang=\"en-US\">An internal server error occurred. The operation failed.</faultstring>
<detail>
<e:ResponseCode
xmlns:e=\"http://schemas.microsoft.com/exchange/services/2006/errors\">ErrorInternalServerError
</e:ResponseCode>
<e:Message
xmlns:e=\"http://schemas.microsoft.com/exchange/services/2006/errors\">An internal server error occurred. The operation failed.
</e:Message>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
我不确定是什么问题,或者我是否在正确的轨道上。
如果有任何关于如何让用户使用 EWS 的建议,我将不胜感激。假设在 Office365 面板上修改或在 PowerShell 中访问 Exchange 的解决方案也可以。
请就此提出建议。
【问题讨论】:
-
这里的最终目标是什么?是否需要通过 EWS/SOAP 获取用户?如果您想使用 powershell 管理 Exchange 上的用户,有更简单的方法可以通过 EMS cmdlet(可通过 import-pssession 和您的 Exchange Hub fqdn 获取)
-
@ChrisKuperstein 目标是让所有用户从 Exchange 与 EWS。如果我不需要 PowerShell 就更好了。谢谢。
-
为什么要创建一个新的全局地址列表?你不应该正常这样做。如果您登录到 Outlook 或 OWA,您会看到哪个 GAL?您在 OWA 或 Outlook 中看到的地址列表是您可以在 EWS 中访问的唯一地址列表。
-
@GlenScales 根据您在此处的回答stackoverflow.com/questions/35782101/… 我在想我需要创建 GAL 并将其 ID 用作 AddressListId。你是说我不需要这样做?只是为了使用我看到 Outlook 或 OWA 的现有 GAL,我将获得所有联系人?好的。那么我如何从我看到的 GAL 中获取 AddressListId。非常感谢。
-
您不应该创建新的 Gal,您只需要使用 Get-GlobalAddressList cmdlet technet.microsoft.com/en-us/library/aa996579(v=exchg.160).aspx 来获取正在使用的默认 GAL 的 Id。如果您无权访问 cmdlet,则需要确保您使用的帐户在 RBAC 中具有地址列表角色
标签: powershell soap exchange-server exchangewebservices