eomeroff
eomeroff

Reputation: 9915

Add contacts to GlobalAddressList Exchange

I want to get all users from Exchange server via EWS. I have realised that it is possible to do with FindPeople SOAP request as described in answer here

As it states in answer, this requires AddressListId. Thus I had to create GlobalAddressList on Exchange with PowerShell.

I have created GlobalAddressList following these instructions

I do not know how to add users into the GlobalAddressList?

Event that there is not users in the list I should be able to get the empty list? So I tried.

Here is is the request:

<?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" value above is GUID of GlobalAddressList that I created.

Here is the response with error that I get.

<?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>

I am not sure what is the problem, or am I on the right track.

I would appreciate any suggestion on how to get users with EWS. The solutions that assumes modification on Office365 panel or in PowerShell access to Exchange are OK also.

Please advise on this.

Upvotes: 0

Views: 419

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

You shouldn't be creating a new Gal, you just need to use the Get-GlobalAddressList cmdlet technet.microsoft.com/en-us/library/aa996579(v=exchg.160).aspx to get the Id of the default GAL that is being used. If you don't have access to the cmdlet you need to make sure the account your using has Address Lists Role in RBAC

Glen

Upvotes: 1

Related Questions