0

I've followed the steps from the following answer: sharepoint 2013 anonymous 401 UNAUTHORIZED1

However, it works partially for me. The REST calls works when I try to access basic information from any list, but when I call 'FieldsValuesAsHtml' endpoint, the response is 401 Unauthorized.

enter image description here

4
  • If I may ask, where are you executing this rest call from? The client browser? If so are you using IE or Chrome? I am wondering if its a cross domain problem. Feb 25, 2019 at 15:47
  • I'm using Google Chrome. The exception occurs only when calling 'FieldsValuesAsHtml' endpoints. Other endpoints works fine.
    – Santiago
    Feb 25, 2019 at 16:14
  • Could I ask you to try to do the exact same thing in IE? Let me know if it works there. If it does than I will explain what is happening Feb 25, 2019 at 16:31
  • Same exception in IE. Thanks for the help anyway.
    – Santiago
    Feb 25, 2019 at 16:59

2 Answers 2

0

Check whether the following REST API works or not.

/_api/web/lists/getbytitle('listname')/items(28)

And then check the REST API below.

/_api/web/lists/getbytitle('listname')/items(28)?$expand=FieldValuesAsHtml
0

Finally, I was able to solve the problem. In order to 'FieldValuesAsHtml' endpoints get to work with both Anonymous and registered users, you have to make the request with POST method and empty body passing the header X-RequestDigest and it's value.

I was able to get the header value from this endpoint: /_api/contextinfo. Just be sure to call this before every 'FieldValuesAsHtml' requests.

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.