While get user’s list of followed sites (using application permissions). By calling GET /me/followedSites endpoint gives "access denied”

Tanvi Mittal 0 Reputation points
2024-05-24T05:16:10.9733333+00:00

Hi team,

I was trying to get user’s list of followed sites (using application permissions). But calling GET /me/followedSites endpoint gives "access denied” and not able to know the root cause for this issue. Is this endpoint is not working, is there any other endpoint that i can try to resolve this issue. Please let us know your suggestions on this.

StatusCode:404

StatusCode: Forbidden RawResponseBody: {"error":{"code":"accessDenied","message":"Access denied","innerError":{"date":"2024-05-06T05:03:33","request-id":"85c976e5-6309-462e-a2d5-89ab8c90d24b","client-request-id":"85c976e5-6309-462e-a2d5-89ab8c90d24b"}}}
Thanks
Tanvi Mittal

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,118 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,060 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,766 questions
SharePoint Workflow
SharePoint Workflow
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Workflow: An orchestrated and repeatable pattern of business activity, enabling data transformation, service provision, and information retrieval.
540 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,865 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yakun Huang-MSFT 1,400 Reputation points Microsoft Vendor
    2024-05-24T06:31:34.9166667+00:00

    Hi @Tanvi Mittal

    According to the Graph Api, /me endpoints cannot be accessed with application permissions, please use the delegation permissions Sites.Read.All or Sites.ReadWrite.All, See the link below for details:

    https://learn.microsoft.com/en-us/graph/api/sites-list-followed?view=graph-rest-1.0&tabs=http

    Screenshot 2024-05-24 142903

    By the way, using delegation permissions requires the use of auth code flow, for which you can see the link below:

    https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

  2. RaytheonXie_MSFT 32,726 Reputation points Microsoft Vendor
    2024-05-24T07:02:16.1466667+00:00

    Hi @Tanvi Mittal,

    GET /me/followedSites only support Delegated (work or school account) with at least Sites.Read.All permission. You could refer to the following document

    https://learn.microsoft.com/en-us/graph/api/sites-list-followed?view=graph-rest-1.0&tabs=http#permissions


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.