web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Copilot Studio - General
Unanswered

Sharepoint Rest api with HTTP request Action in Copilot Studio

(0) ShareShare
ReportReport
Posted on by 4
I am creating copilot with the Authenticate with Microsoft(Entra ID authentication in Microsoft Teams, Power Apps, or Microsoft 365 Copilot) options.
I want to make a http request to the sharepoint site with the urls https://tenant.sharepoint.com/sites/sales/_api/web/lists/getbytitle('Tickets')/items
I am using the HTTP Request Action to do the rest api to sharepoint, but I am getting error
 Error Message: HTTP request failed with status code 403 Forbidden. Error Code: HttpRequestFailure Conversation Id: a32da511-319e-4067-98b6-d6ae5d95494d Time (UTC): 2024-12-19T12:11:57.067Z
 
I hope this is related to Authentication issue but to add the Authorization in the header I am not getting the  System.User.AccessToken  variable. Can Anyone help how can I authenticate the request. ?
 
Any ideas/reference links/ documentation links are highly helpful.
Thanks in Advance
 
 
Categories:
I have the same question (0)
  • TD-19121201-0 Profile Picture
    4 on at
    Sharepoint Rest api with HTTP request Action in Copilot Studio
    @SaiRT14 Thanks for the response. If we use the your approach, The search api will not work with the user context, means it will return all the items from the sharepoint, but i need the results as per the user permission. Is there any way to get the results as per the user permission on the site and list items using the access token approach. 
  • SaiRT14 Profile Picture
    1,988 Super User 2025 Season 2 on at
    Sharepoint Rest api with HTTP request Action in Copilot Studio
    The 403 Forbidden error typically occurs because the request to SharePoint does not have sufficient authentication or permissions to access the resource. 
     
    Ensure that your app (Copilot, Power Automate, or Teams app) has permissions to authenticate to SharePoint using Azure Active Directory. Verify that the System.User.AccessToken variable is enabled in your flow or app. To enable this: Open the HTTP action in Power Automate. Under Settings (gear icon), enable the Secure Inputs and Outputs option. Ensure the connection is authenticated with Azure AD.
     

    If System.User.AccessToken is not available, you can retrieve an access token manually using the following steps:

    • Create an Azure AD App Registration: Go to Azure Portal → App Registrations → New Registration. Provide a name, and under Supported account types, select "Accounts in this organizational directory only." Note the Application (Client) ID and Directory (Tenant) ID.

    • Assign API Permissions: Go to the app's API permissions. Add permissions for SharePoint (Sites.Read.All, Sites.Manage.All, or other relevant permissions). Grant admin consent.

    • Generate a Client Secret: Go to the app's Certificates & Secrets. Create a new client secret and note the secret value.

    • Obtain the Access Token: Use the following HTTP request in Power Automate or a custom script to get the access token. 

      POST https://login.microsoftonline.com/{Tenant-ID}/oauth2/v2.0/token
      Content-Type: application/x-www-form-urlencoded
      grant_type=client_credentials
      client_id={Application-ID}
      client_secret={Client-Secret}
      scope=https://{Tenant}.sharepoint.com/.default
       
    • Use the retrieved token in the Authorization header of your SharePoint request:  Authorization: Bearer {Access-Token}
       

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 385 Super User 2025 Season 2

#2
trice602 Profile Picture

trice602 146 Super User 2025 Season 2

#3
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 144 Super User 2025 Season 2

Last 30 days Overall leaderboard