Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have some trouble to use the Sharepoint2013 Rest API _api/Web/SiteUserInfoList. I need to use a $filter on the Name. I get always a 400 Bad Request. This is my endopoint rest ....my_site.../_api/Web/SiteUserInfoList/items/?$filter=Name eq 'i:0#.w|bs\user' How can I filter on the Name?

Thanks, Nk

share|improve this question
    
have you try with %27 instead of ' ? –  Salvatore Di Fazio Mar 25 at 8:54
1  
I think you need to encode the user name since it contains tons of chars not allowed in a querystring :) You could for example use encodeURIComponent: w3schools.com/jsref/jsref_encodeuricomponent.asp –  Robert Lindgren Mar 25 at 8:54
    
encodeURIComponent() solved my problem :) I tried to use encodeURI() but it didn't work. Thanks :D –  user24623 Mar 25 at 9:04
add comment

2 Answers 2

up vote 0 down vote accepted

Name property value (claim format) should be encoded, for example using encodeURIComponent function or as an alternative you could specify UserName property instead:

/_api/Web/SiteUserInfoList/items?$filter=UserName eq 'username@tenant.onmicrosoft.com'
share|improve this answer
add comment

You need to change the # in the username to %23.

http://spsite/_api/Web/SiteUserInfoList/items/?$filter=Name eq 'i:0%23.w|bs\user'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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