cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
StevenWade
Level: Powered On

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
Community Support Team
Community Support Team

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
Community Support Team
Community Support Team

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

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

StevenWade
Level: Powered On

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.

Anonymous
Not applicable

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

It worked. Thanks :-)

ALEXANDERIII
Level: Powered On

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!

StevenWade
Level: Powered On

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

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 397 members 4,698 guests
Recent signins:
Please welcome our newest community members: