We have a client who has requirements for an automation that includes the creation of Modern Document Libraries in SharePoint.
The first place we looked for automation was Microsoft Flow. In this quick post we’ll cover a few of the details about how we made this happen.
A Quick Word on the Significance of Modern SharePoint Libraries
Many IT departments are working through the transition in SharePoint from “Classic“ to “Modern” experiences. In some cases, tenant level settings may default that all newly created libraries show the Classic experience. The call we are making below creates a new library and sets the experience to Modern.
The Versatile and Extremely Useful “Send an HTTP request to SharePoint” Action
In situations where you are building automations with SharePoint using Microsoft Flow, the HTTP Action can be very helpful in meeting deeper requirements that may not be met by the standard set of SharePoint Actions.
What makes this action so powerful is that you can leverage the vast REST API for SharePoint from MS Flow
If you hit a wall with the stock SharePoint Actions in MS Flow, look into the how the SharePoint REST API and the HTTP Action for SharePoint can help meet your requirements
Best of all is that this powerful Action comes with your basic licensing and doesn’t require a P1 license to use.
Getting Started is easy, use the Action Selector and type in SharePoint HTTP and you’ll find the Send an HTTP request to SharePoint action.
Posting a Request to SharePoint
In this case, our requirement is to create a new library in SharePoint that uses the Modern library in SharePoint. The SharePoint HTTP Action makes this easy.
If you aren’t familiar with the REST API in SharePoint, this article will help you get started.
The Flow Action makes it easy to organize the parameters of your request.
You can see we are calling the Lists endpoint to initiate our request. More details on working with SharePoint lists using the REST API here.
If you have the requirement to create a SharePoint Document Library from MS Flow, you should be able to use the Action’s configuration and JSON below.
Of specific importance is the ListExperienceOptions property.
We are setting Enum value of the property to 1. Here is a reference to the property’s and Enum values
When the call below is made to the REST API in SharePoint, a new library will be created with the Modern Experience activated.
Here is the JSON we used in the above POST request:
"Title": "Sean Modern Test",
Don’t be afraid to try out this highly useful Action in your next Flow! We have found the SharePoint HTTP action to be extremely useful for meeting requirements in our SharePoint integrations.
If you find yourself working with SharePoint a lot, becoming familiar with Microsoft Flow will be useful for you going forward. Microsoft has stated that further investments in SharePoint Designer will not be made. With that said, you may want to look at tools like MS Flow as an alternative to SharePoint Designer Workflows.