6

I'm trying to call the `getpropertiesfor? SharePoint Online's REST endpoint.

https://msdn.microsoft.com/en-us/library/office/dn790354.aspx#bk_PeopleManagerGetPropertiesFor

I'm logged in and am just pasting the url into the browser. I am web encoding the string parameter @v. So my complete URL looks like this.

https://domain.sharepoint.com/_api/sp.userprofiles.peoplemanager/getpropertiesfor(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser.name%40domain.com'

Still I only get the error message.

The query string "accountName" is missing or invalid.

Any pointers on what's wrong? If I call an endpoint without parameters, like the /sp.userprofiles.peoplemanager.gettrendingtags endpoint it works and I get a correct response.

3
  • 3
    The call should look like this: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|[email protected]' Reference: sharepoint.stackexchange.com/a/148320/10271
    – Mx.
    Commented Dec 12, 2016 at 16:50
  • 2
    Thanks, so weird, I can swear I've tried all permutations of everything, from start to end, twice. Nothing worked. Now all of the sudden it works. :) Well, I must have made an error somewhere. Thank you for your time and help.
    – Molotch
    Commented Dec 12, 2016 at 18:36
  • I am getting the same error. my user name is eaonn.o'[email protected] what should I do to resolve this issue.
    – user88090
    Commented Dec 17, 2019 at 12:26

3 Answers 3

8

I also had the same issue but resolved it finally;

Resolution: all the characters should be encoded after @v= (as below)

@v=%27i%3A0%23.f%7Cmemb‌​ership|[email protected]‌​om%27

Full URL will be: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropert‌​iesFor(accountName=@‌​v)?@v=%27i%3A0%23.f%7Cmemb‌​ership|[email protected]‌​om%27

0

As Mx writes in the comment the url formatted as shown here works.

http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropert‌​iesFor(accountName=@‌​v)?@v='i:0%23.f|memb‌​ership|[email protected]‌​om'

Still not sure where the "accountName=@v" addition comes from though. In the documentation (see link in first post) there's no mentioning you have to specify "accountName=", just that you have to supply your account name as a parameter.

0

Here's something that worked for me. After you encode the account name, you still need to replace ':' and '#'.

var encodeAccountName = encodeURI(accountName);
encodeAccountName = encodeAccountName.replace(':', '%3A');
encodeAccountName = encodeAccountName.replace('#', '%23');

In the url you also need to replace '@' in the ?@v= to ?%40v=

'/_api/SP.UserProfiles.PeopleManager/getuserprofilepropertyfor(accountname=@v, propertyname=\'Department\')?%40v=\'' + encodeAccountName + '\''

This is working as this time of writing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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