cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenVdP
Helper I
Helper I

Split string - body HTTP request

Hi,

 

I need some help on retrieving the value "Information Technology", good to know, the value is dynamic and user dependent.

So out of this:

 

{
  "d": {
    "GetUserProfilePropertyFor": "Information Technology"
    }
}

I need to end up with

 

Information Technology

HTTP.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Jay-Encodian
Super User II
Super User II

Hey @BenVdP 

You need to parse the JSON using the 'Parse JSON' action:

2.jpg

The schema (noting you can just generate this automatically in the action):

{
    "type""object",
    "properties": {
        "d": {
            "type""object",
            "properties": {
                "GetUserProfilePropertyFor": {
                    "type""string"
                }
            }
        }
    }
}

 and the outputs:

3.jpg

HTH

Jay

View solution in original post

8 REPLIES 8
Jay-Encodian
Super User II
Super User II

Hey @BenVdP 

You need to parse the JSON using the 'Parse JSON' action:

2.jpg

The schema (noting you can just generate this automatically in the action):

{
    "type""object",
    "properties": {
        "d": {
            "type""object",
            "properties": {
                "GetUserProfilePropertyFor": {
                    "type""string"
                }
            }
        }
    }
}

 and the outputs:

3.jpg

HTH

Jay

View solution in original post

BenVdP
Helper I
Helper I

Hi @Jay-Encodian 

 

Not sure what you mean, can you go into a bit more detail?

 

Thanks.

Paulie78
Super User III
Super User III

You can simply do this:

getJSONval.PNG

The code in the 2nd compose which exposes your value exactly is:

outputs('Send_an_HTTP_request_to_SharePoint')['d']['GetUserProfilePropertyFor']

Hey @BenVdP 

What part don't you follow? the screen shots explain all?

HTH

Jay

BenVdP
Helper I
Helper I

@Jay-Encodian , it took a while for the screenshots to display. 

Your proposed solution works! Thank you!

 

One additional question; It would be nice that I could retrieve multiple attributes (CompanyPeopleUnitId, BusinessSectorName, BusinessUnitName, and DepartmentName)  in one call at once, is this something that can work as well?

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="https://COMPANY.sharepoint.com/teams/SPSITE/_api/"
    xmlns="http://www.w3.org/2005/Atom"
    xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
    xmlns:georss="http://www.georss.org/georss"
    xmlns:gml="http://www.opengis.net/gml">
    <id>https://COMPANY.sharepoint.com/teams/SPSITE/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)</id>
    <category term="SP.UserProfiles.PersonProperties" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" href="SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)" />
    <title />
    <updated>2020-11-06T15:29:56Z</updated>
    <author>
        <name />
    </author>
    <content type="application/xml">
        <m:properties>
            <d:AccountName>i:0#.f|membership|USERID@COMPANY.com</d:AccountName>
            <d:DirectReports m:type="Collection(Edm.String)">
                <d:element>i:0#.f|membership|USERID@COMPANY.com</d:element>
            </d:DirectReports>
            <d:DisplayName>DISPLAYNAME</d:DisplayName>
            <d:Email>EMAIL@COMPANY.com</d:Email>
            <d:ExtendedManagers m:type="Collection(Edm.String)">
                <d:element>i:0#.f|membership|USERID@COMPANY.com</d:element>
            </d:ExtendedManagers>
            <d:ExtendedReports m:type="Collection(Edm.String)">
                <d:element>i:0#.f|membership|USERID@COMPANY.com</d:element>
            </d:ExtendedReports>
            <d:IsFollowed m:type="Edm.Boolean">false</d:IsFollowed>
            <d:LatestPost m:null="true" />
            <d:Peers m:type="Collection(Edm.String)">
                <d:element>i:0#.f|membership|USERID@COMPANY.com</d:element>
            </d:Peers>
            <d:PersonalSiteHostUrl>https://COMPANY-my.sharepoint.com:443/</d:PersonalSiteHostUrl>
            <d:PersonalUrl>https://COMPANY-my.sharepoint.com/personal/USERID_COMPANY_com/</d:PersonalUrl>
            <d:PictureUrl>https://COMPANY-my.sharepoint.com:443/User%20Photos/Profile%20Pictures/USERID_COMPANY_com_MThumb.jpg?t=63628926724</d:PictureUrl>
            <d:Title>FUNCTION TITLE</d:Title>
            <d:UserProfileProperties>
                <d:element m:type="SP.KeyValue">
                    <d:Key>COMPANYPeopleUnitId</d:Key>
                    <d:Value>PeopleUnitID</d:Value>
                    <d:ValueType>Edm.String</d:ValueType>
                </d:element>
                <d:element m:type="SP.KeyValue">
                    <d:Key>BusinessSectorName</d:Key>
                    <d:Value>BusinessSectorName</d:Value>
                    <d:ValueType>Edm.String</d:ValueType>
                </d:element>
                <d:element m:type="SP.KeyValue">
                    <d:Key>BusinessUnitName</d:Key>
                    <d:Value>BusinessUnitName</d:Value>
                    <d:ValueType>Edm.String</d:ValueType>
                </d:element>
                <d:element m:type="SP.KeyValue">
                    <d:Key>DepartmentName</d:Key>
                    <d:Value>DepartmentName</d:Value>
                    <d:ValueType>Edm.String</d:ValueType>
                </d:element>
            </d:UserProfileProperties>
            <d:UserUrl>https://COMPANY-my.sharepoint.com:443/Person.aspx?accountname=i%3A0%23%2Ef%7Cmembership%7CUSERID%40COMPANY%2Ecom</d:UserUrl>
        </m:properties>
    </content>
</entry>

Hey @BenVdP 

I've marked this one as a solution, helps other find answers to the same question.

Retrieving multiple attributes is fine, the same approach should work... it should be a case of parsing the JSON.

If you need further guidance can you post a new query (mention me on the post via an @) with the same sample data you're working with

HTH

Jay

For others interested in my follow-up question, visit this topic.

@BenVdP - I have replied to the other post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (83,634)