Connect To SharePoint with MS Graph in spfx

luee johnlu 100 Reputation points
2024-04-30T17:36:41.3266667+00:00

Hi

I´ve created SPFx webpart in sharepoint, and I want to call graph api in the webpart. But the console always return 403 error. I have grant sites.fullcontrol to the application. But I can't even call the most basic api like /sites/{site-id}/lists/{list-id}/items

Please provide some gudiance.

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 32,081 Reputation points Microsoft Vendor
    2024-05-01T01:46:28.83+00:00

    Hi @luee johnlu,

    You can follow below Microsoft official documentations to use Microsoft Graph in react based SharePoint framework (SPFx) web parts:

    1. Use the MSGraphClient to connect to Microsoft Graph
    2. Consume the Microsoft Graph in the SharePoint Framework

    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.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. elaisdlsdla 0 Reputation points
    2024-04-30T17:41:31.3933333+00:00
    0 comments No comments