SharePoint Online specific.

I wanted to know if it is possible to enforce file naming conventions at the folder or sub-folder level in a Document Library.

For example, I have a Document library called "Documents" with many sub-folders. I want to enforce a specific file naming convention for all Word (docx) files uploaded to a "Legal" folder, e.g. "Document_Name_Department_MMYYYY".

Then similarly a different file naming convention in the folder "IT", etc.

I have found a site that explains how to do it using the CSOM (https://www.tatvasoft.com.au/blog/how-to-implement-remote-event-receiver-in-sharepoint-online/).

Is anyone aware if this is possible using JS, no-code, Azure or Flow? basically an alternative way rather then the CSOM example listed above.


2 Answers 2


How about just adding Departement as a metadata field on the library? If needed you can inject that value into the doc as a quick part. Enforcing a naming conversion is a huge can of worms, so user training and monitoring often is better way than a technical solution

  • Hi Kasper, while I do agree with you, required metadata is a pain when people produce lots of content, having to constantly tag each file uploaded into the document library. Meanwhile, Modern Search does not even pick up the metadata or allow you to filter by it. Which kind of puts you back in the same place as folders, albeit you can do slightly more with metadata then folders, but then when you sync it to your File Explorer you get nothing..so all in all it feels like a bit of a catch 22 until the modern search customizations come into play.
    – Ushka
    Oct 14, 2019 at 20:12
  • As I am a Search geek I had a very hard time trying to understand why MS didn't provided any modern search web parts, so I am using the PnP Search web parts and I am not sure MS ever plan to catch up, why should they? The community is doing a great job Oct 14, 2019 at 20:23
  • Are you referring to this? github.com/SharePoint/sp-dev-solutions/tree/master/solutions/…. Would be curious to hear what to use as a starting point if I want search results filterable by custom metadata (incl. managed metadata).
    – Ushka
    Oct 14, 2019 at 20:38
  • That is the one and filtering by custom metadata is out of the box :-) Check out youtube.com/watch?v=g41nvRVwtds Oct 14, 2019 at 20:48

You can use SharePoint Designer Workflow or Microsoft Flow to update filenames on creation, but it’s not much of an enforcement.

Please see the post below.

How to give naming convention for a document library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.