0

To access the create list and create custom list item in sharepoint I got the error

{
"error": {
    "code": "-2147024891, System.UnauthorizedAccessException",
    "message": {
        "lang": "en-US",
        "value": "Access denied. You do not have permission to perform this action or access this resource."
    }
}

}

How to solve this error?

  • can you share the code you are using which is giving this error ? Also, do you have the necessary rights to create list & list items ? – Gautam Sheth Nov 7 '17 at 12:02
0

You Need to set the rtFa and FedAuth cookies in the request when you use Postman or Fiddler for testing. You can get the cookie values in the browser console after successfully authenticating in another tab or window. The format for the Cookie header is FedAuth=[paste FedAuth cookie value here];rtFa=[paste rtFa cookie value here]

enter image description here

enter image description here

If you are creating a production app and it is calling the REST API from outside of SharePoint, you need to retrieve an access token and use it in the Authorization header. To retrieve the access token in this case, you are best off using ADAL. ADAL is available in many platforms and languages. Explaining how to use ADAL is out of the scope of this answer, but you can find many tutorials online.

If you are calling the REST API from inside of SharePoint via JavaScript, the browser will automatically include the cookie in the request.

0

Thanks for the concern. I solve the problem by giving the scope=Web.Manage only to get access-token.

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.