2

I'm trying to retrieve a single user property from a jsom script.

The property is a custom one, not in the default schema.

When I retrieve

http://server/sites/coll/_api/sp.userprofiles.peoplemanager/GetMyProperties/
UserProfileProperties

I get all properties.

When I retrieve

http://server/sites/coll/_api/sp.userprofiles.peoplemanager/GetMyProperties/
UserProfileProperties/MySingleProperty

an error is thrown.

I also tried:

http://server/sites/coll/_api/sp.userprofiles.peoplemanager/GetMyProperties/
UserProfileProperties/?select=MySingleProperty

It does not fail, but all properties are still returned.

What is the correct syntax to retrieve my property?

[Edit] Don't know if it matters, but my property has an hyphen in its name: My-Single-Property. I tried to escape using unicode like this: My%u002dSingle%002dProperty, but without success.

You can repro using an OOB field:

_api/sp.userprofiles.peoplemanager/GetMyProperties/?$select=SPS-JobTitle _api/sp.userprofiles.peoplemanager/GetMyProperties/?$select=SPS%2dJobTitle _api/sp.userprofiles.peoplemanager/GetMyProperties/?$select=SPS%u002dJobTitle

2
  • Can you specify is there any specific property you are looking for, or you want all properties for a specified user?
    – Gaurravs
    Dec 18, 2015 at 10:26
  • @Gaurravs: not sure to understand. I want to retrieve a single property for the current logged in user
    – Steve B
    Dec 18, 2015 at 10:27

2 Answers 2

1
http://siteurl/_api/SP.UserProfiles.PeopleManager/
GetMyProperties?$select=**YourPropertNameHere**

This should give a specific single property

I hope this is what you are searching for.

2
  • 3
    This does not works for custom properties.
    – Steve B
    Dec 18, 2015 at 13:05
  • Any option to make it work for custom property? Oct 26, 2016 at 18:14
0

You can use of $filter in REST API.

E.g

http://server/sites/coll/_api/sp.userprofiles.peoplemanager/GetMyProperties/
UserProfileProperties/?$select=MySingleProperty&$filter=COLUMN1 eq 'VALUE11'

Reference :

http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html

4
  • This does not works. All properties are still retrieved
    – Steve B
    Dec 18, 2015 at 10:29
  • Let me do some search , i'll be back to you.
    – Dipen Shah
    Dec 18, 2015 at 10:31
  • Are you getting your custom property in all properties?
    – Dipen Shah
    Dec 18, 2015 at 10:33
  • Yes. I can see my custom property
    – Steve B
    Dec 18, 2015 at 13:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.