Skip to content

403 Forbidden Error on SharePoint API Request #984

@11joao44

Description

@11joao44

When attempting to access the SharePoint API endpoint /_api/contextInfo, the request fails with a 403 Client Error: Forbidden.

The server returns the following error message, indicating a permissions issue:

XML

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="pt-BR">Attempted to perform an unauthorized operation.</m:message>
</m:error>
This System.UnauthorizedAccessException suggests that the client does not have the required permissions to perform the operation on the specified resource.

Option 2: Formal Bug Report Template
Issue Title: API Call to /_api/contextInfo Fails with System.UnauthorizedAccessException

Bug Report

  1. Observed Behavior:
    A request made to the SharePoint API endpoint https://mywork.sharepoint.com/sites/SiteWork/_api/contextInfo is failing with a 403 Forbidden status code.

  2. Expected Behavior:
    The request should successfully return the context information for the site, likely in XML or JSON format, with a 200 OK status code.

  3. Error Details:
    The full response body from the server is an XML error message:

XML

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="pt-BR">Attempted to perform an unauthorized operation.</m:message>
</m:error>
HTTP Status Code: 403 Forbidden

Exception Code: -2147024891, System.UnauthorizedAccessException

Message: Attempted to perform an unauthorized operation.

  1. Analysis:
    The error indicates an authorization problem. The user or application principal making the call lacks the necessary permissions to access this specific API resource on the My List SharePoint site. An investigation into the assigned permissions is required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions