3

current situation: I am retrieving Data from a SharePoint List using the SharePoint webservices call "GetListItems".

Unfortunately I have multiple columns which are of Type Person. They only display the Person's name but I want to retrieve also the person's email address.

I found this:

<QueryOptions><ExpandUserField>TRUE</ExpandUserField></QueryOptions>

and inserted it here:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <listName>blahblah</listName>
            <query>
                <Query>
                    <Where>
                        <And>
                            <Eq>
                                <FieldRef Name='result' />
                                <Value Type="Text">Relationship declined</Value>
                                </Eq>
                            <Eq>
                                <FieldRef Name='Tracking_x0020_performed' />
                                <Value Type="Text">Open</Value>
                            </Eq>
                        </And>
                    </Where>
                  <QueryOptions><ExpandUserField>TRUE</ExpandUserField></QueryOptions>
                </Query>
            </query>
            <viewFields>
                <ViewFields xmlns="">   </ViewFields>
            </viewFields>
            <rowLimit>5000</rowLimit>    
        </GetListItems>
    </soap12:Body>
</soap12:Envelope>

I am not getting any particular extra information about the person-type fields in my response XML, just the fields which are already in the SP List.

So how can I retrieve email etc. out of the person type fields? As I said I am just getting their display names.

R. Pacino
  • 51
  • 3
  • May be you should contact the service provider if the service is not working. I am afraid any help can be offered in this case. – Rao Feb 20 '18 at 14:30
  • Thanks @Rao. I thought maybe I am building something wrong in my XML request. – R. Pacino Feb 20 '18 at 14:32

1 Answers1

2

I solved it by myself.

For all who are interested, this is the correct way:

<queryOptions>
   <QueryOptions>
      <ExpandUserField>TRUE</ExpandUserField>
   </QueryOptions>
</queryOptions>

PLUS it has to be just below the "GetListItems" Level - so at the same level as "listName" and "query"

R. Pacino
  • 51
  • 3