Get users from Global Address List (GAL) using FindPeople operation of Office 365 RRS feed

  • Question

  • I need to find details of all users using FindPeople operation. If I perform any search by giving value in the <QueryString> element, I get result from both GAL + My Contacts but if I remove the QueryString, I am forced to provide folder name in which to search else I get "Internal error" resonse.

    Is there any way I can retrieve/browse all the users in GAL ?

    Tuesday, June 3, 2014 5:34 AM

All replies

  • Hi,

    I think you need to mention 'Directory' as the folder as shown in this page:

    See this section:

    The following example of a FindPeople operation request shows how to return the first 100 contacts from the GAL by using a query string. Setting theDistinguishedFolderId to "directory" will search the GAL as the primary source of personas.


    Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM)

    Tuesday, June 3, 2014 10:33 PM
  • >> I need to find details of all users using FindPeople operation

    How big is your GAL ? the problem with using a QueryString if you want all users is even if you use a string like SMTP: this will only return the first 100 entires in the GAL. There is a note in the link Laeeq posted that states " When searching the GAL as the primary search folder, you must specify a query string instead of a restriction, because this operation does not allow for browsing of the GAL." 

    One way you can use to browse the GAL using this operation is to use the Guid of the Gal (or other address list you want to browse) you can get the Addresslist guid using the Get-GlobalAddressList cmdlet and then you can use code like

                FindPeopleType fpType = new FindPeopleType();
                IndexedPageViewType indexPageView = new IndexedPageViewType();
                indexPageView.BasePoint = IndexBasePointType.Beginning;
                indexPageView.Offset = 0;
                indexPageView.MaxEntriesReturned = 100;
                indexPageView.MaxEntriesReturnedSpecified = true;
                fpType.IndexedPageItemView = indexPageView;
                fpType.ParentFolderId = new TargetFolderIdType();
                DistinguishedFolderIdType contactsFolder = new DistinguishedFolderIdType();
                AddressListIdType adList = new AddressListIdType();
                adList.Id = "2117949e-abe8-4915-91eb-9999f867fd8de";
                fpType.ParentFolderId.Item = adList;
                FindPeopleResponseMessageType fpm = null;
                    fpm = esb.FindPeople(fpType);
                    if (fpm.ResponseClass == ResponseClassType.Success)
                        foreach (PersonaType PsCnt in fpm.People) {
                        indexPageView.Offset += fpm.People.Length;                    
                    else {
                        throw new Exception("Error");
                } while (fpm.TotalNumberOfPeopleInView > indexPageView.Offset);
    Wednesday, June 4, 2014 2:18 AM
  • "Directory" works only for On-Premise exchange server and not for cloud hosted service. I tried that but no result.

    • Edited by nwaswani Wednesday, June 4, 2014 5:06 AM
    Wednesday, June 4, 2014 5:06 AM