Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Creating a flow to automatically add numbers to documents upload on SharePoint



I have a SharePoint Library in where I want a number to be allocated to a document when it is uploaded. It should follow a sequence such as 0001,0002,0003, etc.


I have built something of a flow but I cannot seem to get it right?

I feel I might be missing an expression itself somewhere within the flow.


Flow as below:






Any assistance is appreciated.



Super User
Super User

Every item that you add to a SharePoint library will already have one of these numbers, @DrishM13.


This is because when you add a document to a library, it is actually putting it into a list. So all you need to do is get the ID that it has given that document in the list.


I'll either edit this reply with a quick 'how to' of how to retrieve and modify that into the document name/title/whatever, or reply again, dependent on other responses.

Helper II
Helper II

Hi @eliotcole - so I can use the ID field already from SharePoint and modify that using a flow to something specific that I want? 

Can you please let me know how to do that?

Thank you.

Super User
Super User

I can try, @DrishM13 , but my attempts to demo it are hitting a snag because I'm using the 'General' folder ... and now I WANT to get that working.


Anyway ... I'll create a separate library, and do it that way, save the effort. 😅


Super User
Super User

Here you go, @DrishM13, this is with a simple document library with documents created in the main folder:

simple rename.jpg


The Uri field is:


The Body field is:

	"formValues": [
			"FieldName": "FileLeafRef",
			"FieldValue": "@{triggerOutputs()?['body/ID']} - @{triggerOutputs()?['body/{FilenameWithExtension}']}"

You can copy those directly into the fields if you make this yourself, replacing any renamed variances, of course. For example, you need to be sure to get the name of the library right, the easiest way to do that is to open the library, and look at the URL ... so for this one it's /sites/eliotflows/fileLibraryOne/Forms/AllItems.aspx. I just need that 'fileLibraryOne' part. Yours won't be called fileLibraryOne. 🙂

Helpful resources

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,775)