1

I would like to get all users from xchange server with EWS. I have figured out how to get all rooms and all appointments. But I specifically need all users thus I can CRUD users from my application. Is this even possible? I did not find any example online. Please advise on how to achieve this.

How would soap request look for user CRUD operations?

Tim
  • 129
  • 2
  • 3
  • 15
eomeroff
  • 9,599
  • 30
  • 97
  • 138

2 Answers2

3

On Exchange 2013 and above you can use the FindPeople operation with the GUID of the address list you want to access (eg for the Global Address List you use the GAL's guid).

    <?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="5c90c254-2463-4256-bf52-60d82e6baa44" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
          </ParentFolderId>
        </FindPeople>
      </soap:Body>
    </soap:Envelope>

You can then page the results back using the Offset

The one catch with this is you can't get the GUID you need using EWS you need to use the Get-GlobalAddressList cmdlet https://technet.microsoft.com/en-us/library/aa996579(v=exchg.160).aspx in Exchange Management Shell which will return the GUID you need for the request.

Cheers Glen

Glen Scales
  • 20,495
  • 1
  • 20
  • 23
  • Thank you very much. Is there any work around to get the same result with Exchange 2010? – eomeroff Mar 04 '16 at 12:32
  • 1
    On 2010 you are better to use LDAP and look AD directly http://www.infinitec.de/post/2011/10/25/Searching-the-Global-Address-List-C-Edition.aspx the only work around for EWS is use a Group, add all the recipients you want returned to the group then use ExandGroup – Glen Scales Mar 07 '16 at 03:23
  • @GlenScales I actually just do direct PSSessions with Powershell v2 and import-possession to get all the native EMS cmdlets imported to my local host. – Chris Kuperstein Mar 25 '16 at 17:02
1

In response to some of your comments:

A good way to work with Exchange 2010 (And this method works here in my network, where we run E2010) is through interactive Powershell sessions with your hub exchange server that has Exchange Management Tools installed, running powershell version 2.0.

The goal is as follows:

  1. Create a new interactive session with New-PSSession
  2. Import that session to make the remote cmdlets native to your local host.

.

$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YOURFQDNOFTHEEXCHANGESERVERHERE/powershell
Import-PSSession $session | out-null

Then you will be able to use things (cmdlets) available to Exchange Management Shell/EMC as if you were remotely logged into the exchange server itself.

This method was extracted directly from the Exchange Management Tools installation directory itself, which is how the Exchange Management Shell actually imports the modules/functions/extended cmdlet functionality to the regular powershell host.

From that point forward, I'd highly recommend for you to google/search Exchange 2010 powershell commandlets, as they are extremely useful and powerful (no pun intended) tools to help manage AD objects, Exchange objects, etc.

  • Thank you very much for your answer. I can not say that I have fully understood all you have said, but I assume that it is important to say, that I have no local settings for E2010, just remote access to it. It is remote access from some Windows machine and EWS soap call from JavaScript applications. That is all I can work with. Thanks. – eomeroff Mar 25 '16 at 18:10