I'm trying to call the "getpropertiesfor" Sharepoint Onlines REST endpoint.


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


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
    The call should look like this: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|user@domain.com' Reference: sharepoint.stackexchange.com/a/148320/10271 – Mx. Dec 12 '16 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 Dec 12 '16 at 18:36

I also had the same issue but resolved it finally;

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


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


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


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.


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, privacy policy and cookie policy

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