cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

Wanted to post some lessons learned after 2+ hours of trying to configure the 'Send an HTTP Request to SharePoint' action to create a Document Library list. I'm working on a case management application that requires a new DocLib be created when a new case is received. I did a lot of looking around for a step-by-step on getting this to work, but couldn't find one; so, I'm creating this thing here. Maybe everyone else has figured this out--ergo no documentation.

 

There are now two methods within Flow to accomplish this--either via the SharePoint connector or by using the HTTP connector against Microsoft Graph. Currently, you can't configure a Flow to connect to Graph "on behalf of" a user (this is a huge limitation IMO), and our ITSec doesn't want to hand out SITES.MANAGE.ALL to a bunch of rando Graph apps. As a result, the path of least resistance for me was to use the SharePoint connector on a Service Account in Flow. 

 

Here's what a working POST using the 'Send an HTTP Request to SharePoint' action to create a new basic list object should look like.

 

Site address: https://<yourdomain>.sharepoint.com/sites/<sitename>  (path to site where you're creating the lib)

 

URI: _api/lists

 

Headers

 

{
  "content-type": "application/json"
}

 

Body

 

{
 "Title": "TestList1",
 "BaseTemplate": 101,
 "Description": "My list description",
 "OnQuickLaunch": false
}

 

The only required properties are Title and BaseTemplate. If you're looking for extended properties to further refine your list creation, use the SPList property reference on MSDN, here:

 

https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.splist_properties.aspx

 

This same pattern should work for exposed via the SharePoint REST API--using the appropriate URI and class properties for the object you're trying to create. I haven't tested it against everything, but can create sites and list items and run some basic ODATA queries.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

Hi @StevenWade,

 

Thanks for sharing.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

Hi @StevenWade,

 

Thanks for sharing.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

Hi, In my scenario,

I'm having a people picker with multi select users option and by using send HTTP request to sharepoint i was able to get User details into PowerApps, But When i try to use the same method and Get details of Another column details which is just a Singleline Text column. Its giving me Error on flow: The field or property 'Description' does not exist Any ideas would help.

Thanks

Highlighted
Advocate II
Advocate II

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

Not sure what's causing the error. Have you tried using the native 'Get Items' SharePoint action against a custom view that returns only the fields you need? While it's not a hard and fast rule, I generally try to use the native Flow actions for SharePoint unless my use case isn't supported.

 

You've probably already tried this, but for troubleshooting you can write your HTTP REST request to pull back the entire list fieldset for each item, and take a look at how SP is returning the JSON. Also, depending on the number of records/fields you're returning, the additional overhead of returning the entire fieldset (vs just the Description column) is fairly limited.

Highlighted
Anonymous
Not applicable

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

It worked. Thanks 🙂

Highlighted
Advocate I
Advocate I

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

Hello, I cannot find any SP property to set up new list created through HTTP as Inplace records managemnt list. Any ideas what parameter would it be?

 

Thank you!

Highlighted
Advocate II
Advocate II

Re: Using "Send an HTTP Request to SharePoint" to create SP List objects: Tips

url: http://site url/_api/web/lists
method: POST
body: { '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 100,
 'ContentTypesEnabled': true, 'Description': 'My list description', 'Title': 'Test' }
Headers: 
    Authorization: "Bearer " + accessToken
    X-RequestDigest: form digest value
    accept: "application/json;odata=verbose"
    content-type: "application/json;odata=verbose"
    content-length:length of post body

If I'm not mistaken, you have to set the BaseTemplate to the correct integer corresponding to the Records Management list type. Here's a list I have bookmarked for all the template ids: https://www.morgantechspace.com/2016/08/list-of-sharepoint-list-template-ids.html. The Record Libary is 1302.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (7,830)