cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
panterra
Level 8

HTTP Action - SharePoint REST Call Failing

Hi Everyone,

 

I am trying to make a SharePoint REST API call from Flow.  The stock SharePoint actions don't cover the functionality I am trying to acheive. 

 

Here is what I have done:

  • I have registered an Add-In for SharePoint using Full Control
    • I have also set the AllowAppOnlyPolicy=true
  • I am able to generate a bearer token using a REST API call using the Add-In's Client Id and Secret. 
  • I use the bearer token to make an OAuth2 call to the SharePoint REST API
    • I am unable to reveive results from my query.

 

The results I receive are: 

 

{
  "d": {
    "results": []
  }
}

Here is the FLOW HTTP Action (inputs and outputs):

 

REST-Result-1.png

 

This all looks fairly normal - accept there are items that should be returned by this REST call.  Any ideas why items are not being returned? 

 

Has anyone been able to follow this pattern with success?

 

Thank you!

Sean

1 ACCEPTED SOLUTION

Accepted Solutions
panterra
Level 8

Re: HTTP Action - SharePoint REST Call Failing

This was an issue on my side.  I didn't register the permissions of the App in SharePoint correctly.  Specifically, I had an issue with the Scope attribute on the AppPermissionRequest element: 

 

  • <AppPermissionRequests><AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl"/></AppPermissionRequests>

 

View solution in original post

7 REPLIES 7
panterra
Level 8

Re: HTTP Action - SharePoint REST Call Failing

This was an issue on my side.  I didn't register the permissions of the App in SharePoint correctly.  Specifically, I had an issue with the Scope attribute on the AppPermissionRequest element: 

 

  • <AppPermissionRequests><AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl"/></AppPermissionRequests>

 

View solution in original post

Highlighted
Community Support Team
Community Support Team

Re: HTTP Action - SharePoint REST Call Failing

Hi @panterra,

 

Thanks for your sharing. Do you get the result that you want successfully?

 

If you have not get the result that you want successfully, please post your issue here, I would provide a workaround for your issue.

 

Best regards

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
panterra
Level 8

Re: HTTP Action - SharePoint REST Call Failing

Hi,

 

The issue was with how I registered the SharePoint Add-In.  It worked successfully after this. 

 

Much Thanks,

Sean

 

anhthuch4ng
Level 8

Re: HTTP Action - SharePoint REST Call Failing

Hi @panterra,

 

Glad you were able to get your Flow running successfully!

Would you mind sharing the steps you took to successfully register your SharePoint Add-In? That way, other community members who may be having similar issues can follow along with your process.

 

And if you found that solution to be satisfactory, please go ahead and mark this thread as "Solved". 🙂

 

Looking forward to seeing your solution!

-AT (Community Admin)

panterra
Level 8

Re: HTTP Action - SharePoint REST Call Failing

For other folks who are interested in using Flow to make custom API calls to SharePoint Online, here are the steps I took to register my app and get connected. 

 

If you have requirements for integration with SharePoint that fall outside of the avaialble SharePoint Actions, this may be a good option for you.

 

This example allows you to use the add-in framework to register an app in SharePoint and the use OAuth to access SharePoint content.  This way, you don't have to store user credentials anywhere.

 

Get Your Tenant Id

You'll need Office365 Tenant Id to get started:

This piece of PowerShell will help you find it, or you can login to your Azure AD portal to get it:

Register Your SharePointy Online App

  • You'll need to log into your SharePoint Online implementation and have the necessary permissions to do this step.
  • On your tenant, browse to the Site Collection you would like to access.
  • Browse to this address: https://[myTenant].sharepoint.com/sites/[mySiteCollection]/[optional: subWeb]/_layouts/15/appregnew.aspx
    • App Domain: localhost
    • Redirect URI: https://localhost
    • Use the Generate buttons to get a Client Id and Client Secret
      • Record these somewhere!
  • After registering your app, you need to give it permissions to do things

Authorize Your SharePoint Online App

  • You'll need to do this step or your app will not be able to do anything
  • Navigate to this address: https://[myTenant].sharepoint.com/sites/[mySiteCollection]/[optional: subWeb]/_layouts/15/appinv.aspx
    • Provide the App Id from the previous step and use the Lookup button to retrieve your app's info
    • In the Permission Request XML, provide the xml string below:
      • VERY IMPORTANT! Note the Scope attribute: http://sharepoint/content/sitecollection/web it must match the permissions you will need for the eventual call you will be making.  This string provides you with SPWeb permissions, you may need Site Collection level permissions dpeending what you are doing.  See link below for other examples.
<AppPermissionRequests><AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl"/></AppPermissionRequests>

 

Once you have completed these steps, your ready to use the HTTP Action to connect to SharePoint Online using the app's credentials.

 

Request a Bearer Token from your Tenant

Here is how I built this action:

Note: The resource querystring value can be left as shown in this example to connect to SharePoint Online

Get Bearer Token.png

 

 

Capture the access_token output from the above step

 

Call SharePoint Online From Flow

Next, you should be able to make a remote API call to SharePoint Online:

RemoteREST.png

anhthuch4ng
Level 8

Re: HTTP Action - SharePoint REST Call Failing

Hi @panterra,

 

This is a fantastic breakdown of your process to solve your Flow issue! Super appreciate the screenshots.

Thank you for sharing and participating in the Flow Forum. 🙂

 

Happy Flowing,

-AT (Flow Community Admin)

mbrocchi1
Level 8

Re: HTTP Action - SharePoint REST Call Failing

I'm not sure if this is still relevant to you but I recently posted a video using the new SharePoint HTTP request action in Flow. I call the set item permission and Break inheritance end points to secure SharePoint List items after they are posted via a PowerApps application -

 

SharePoint Item Level Security in PowerApps and Flow

 

Hope this helps.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,501)