Skip to main content
< All Articles

Why you need a file naming convention in SharePoint

Posted on July 21, 2016

I always get questions from my clients on whether you need to adhere to some sort of file naming convention in SharePoint. The answer is YES, in fact, it is a must if you are using metadata. It has to do with the way SharePoint treats duplicate file names. In SharePoint, the file name is the primary (unique) key that identifies the file. That means that if you try to upload another document with the same file name, it treats it as another version of the same file and will overwrite the previous version without warning!

NOTE: Please check out this most recent article on the file naming convention in SharePoint. While the particular issue described in this post still applies, there are other factors that impact the decision on whether or not file naming convention should be used in SharePoint Online.

Let me demonstrate this to you in the example below.

  1. The user uploads a document to the library. Note that the checkbox next to Add as a new version to existing files is checked by default namingconvention1
  2. User tags the document with some metadata namingconvention2
  3. Another (or same user) uploads the document with the same file name again to that same library. Let’s pretend that it is an Agenda from another meeting. So while the file name is the same, the document itself is different. But look at what happens on the metadata screen. All the metadata fields are empty again and the version of the document is 2.0. What is going on here?
  4. What happens is that it treats that 2nd document as another version of the same file. So it creates another version!!!
  5. Unfortunately, the file also looses all the metadata. This behavior (lost metadata) is unique to just the new MS Office file formats (.docx, .xlsx, .pptx), not the older MS Office formats (.doc,  .xls, .ppt) or other file types (i.e. PDF, TXT, etc.)]

How to prevent file overwrite in SharePoint

There are few ways to prevent accidental file overwrite in SharePoint

  1. Uncheck the box during file upload. When you upload a document, uncheck Add as a new version to existing files checkbox. This has to be done manually every single time. There is no easy (out of the box way) to disable this checkbox globally. Once you uncheck the box and click OK, you will get an error message, prompting you to rename the uploaded file. namingconvention5 namingconvention6
  2. Upload files using drag and drop. The file overwrite issue only occurs when you upload a file using the Upload button. If you drag and drop the file into the browser, it actually gives you a great warning message, asking you to either replace the file (upload as another version) or stop the upload. This message gives you a second chance and allows you to check into the original document and rename the file (if need be). This totally makes sense to me and I wish this sensible message was there during the regular file upload.  namingconvention11
  3. Separate files into folders. I can’t believe I said that. For obvious reasons, you will only encounter the overwrite issues if you have 2 files with the same file name in the same folder. That means that if you use metadata, you have higher chances of running into an “accidental overwrite” situation. With metadata, everything resides in 1 big bucket. If you use folders, the likelihood of file overwrite is minimized.
  4. Come up with a file naming convention. If you do use metadata (I hope you do), the best way to avoid accidental overwrite is by instituting some sort of naming convention. It is very unlikely that users will remember to always uncheck that box in Step 1, so a solid naming convention is a great alternative. As far as the advice on the naming convention, it really varies from company to company. I don’t think you will ever find a standard that is one size fits all. I usually like to insert some sort of descriptive information into a file, like a client or vendor name. Another technique is to insert a date into the file name (i.e. 20160624) – this helps make the document unique and is is a sure way to prevent file overwrites.

About Me

I’m Greg Zelfond, a U.S. based SharePoint consultant, and I provide affordable out-of-the-box SharePoint consulting, training, and configuration assistance to small and medium-sized businesses all over the world.

Need help?