将联系人添加到 GlobalAddressList Exchange

Add contacts to GlobalAddressList Exchange

我想通过 EWS 从 Exchange 服务器获取所有用户。我已经意识到可以按照答案

中的描述处理 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的解决方案也可以。

请指教。

您不应该创建新的 Gal,您只需要使用 Get-GlobalAddressList cmdlet technet.microsoft.com/en-us/library/aa996579(v=exchg.160).aspx 来获取正在使用的默认 GAL。如果您无权访问该 cmdlet,则需要确保您使用的帐户在 RBAC

中具有地址列表角色

格伦