How to create a flow to create new document library after certain amount of items is created

weismuller 21 Reputation points
2021-09-23T05:55:28.997+00:00

Hi y'all,

I would need your expertise to help me to solve the following problem:

When in a document library, the amount of items has reached 5000, I would like Power Automate to create a new document library automatically.

Is there a way to solve this with flows?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,686 questions
{count} votes

Accepted answer
  1. Emily Du-MSFT 41,941 Reputation points Microsoft Vendor
    2021-09-24T09:54:15.367+00:00

    @weismuller

    Please follow below pictures to create a flow.

    1.Set trigger and get files.
    134946-1.png
    2.Create a compose.
    135024-2.png
    134987-1.gif
    3.Create a condition and create a new document library.
    Uri:_api/web/lists
    Headers:
    accept application/json;odata=verbose
    content-type application/json;odata=verbose
    Body:
    {
    '__metadata':{ 'type':'SP.List' },
    'AllowContentTypes': true,
    'BaseTemplate':101,
    'ContentTypesEnabled':true,
    'Description':"",
    'Title': 'newdoc'
    }
    135041-3.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. weismuller 21 Reputation points
    2021-09-28T12:23:03.787+00:00

    Thanks @Emily Du-MSFT , I got this working now. Problem why new library was not created was apparently that condition was set so that outputs is greater than 5000 (that was what i asked), but it seemed that Sharepoint Online couldn't take to output over 5000. When I changed the condition "outputs is greater than 4999", it worked.

    135924-image.png

    0 comments No comments