2

This question already has an answer here:

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

marked as duplicate by John-M, Benny Skogberg Dec 23 '15 at 5:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Can you specify is there any specific property you are looking for, or you want all properties for a specified user? – Gaurravs Dec 18 '15 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 '15 at 10:27
0
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
    This does not works for custom properties. – Steve B Dec 18 '15 at 13:05
  • Any option to make it work for custom property? – Varun Verma Oct 26 '16 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

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

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