question

weismuller-3898 avatar image
0 Votes"
weismuller-3898 asked weismuller-3898 answered

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

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?

office-sharepoint-online
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@weismuller-3898

Thank you for your question. 

We are currently looking into this issue and will give you an update as soon as possible.

Thank you for your understanding and support.

0 Votes 0 ·
EmilyDu-MSFT avatar image
0 Votes"
EmilyDu-MSFT answered EmilyDu-MSFT commented

@weismuller-3898

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.png (53.4 KiB)
2.png (6.9 KiB)
1.gif (122.6 KiB)
3.png (43.0 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@weismuller-3898

I’m checking how the things are going on about this issue. Whether the answer helps you?

If there is any problem with this issue, feel free to let me know.

0 Votes 0 ·

Thank you very much for your answer.

I managed to create the flow with your instructions, and Flow checker said it was good. I tested it in practice after that by moving +5000documents to the document library where I connected the flow, but no new document library was created after that.

I have no idea what might have went wrong as the flow itself didn't create any errors. Something is obviously still wrong.

And one detail I didn't mention in my original question: the new document library should contain the same columns and metadata as the one that contains 5000 documents.

I really appreciate your help and effort.

0 Votes 0 ·

@weismuller-3898

Select the action Get files (properties only) ->Three dots -> Settings -> Enable Pagination -> Set the Threshold.

135886-1.png
135912-2.png

Create a document library with columns is a very complicated process, beyond the scope of technical support, I suggest you start a new discussion in the Microsoft Power Automate Community.


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.




0 Votes 0 ·
1.png (34.8 KiB)
2.png (13.6 KiB)
weismuller-3898 avatar image
0 Votes"
weismuller-3898 answered

Thanks @EmilyDu-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



image.png (22.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.