Maximum File Name Length for OneDrive for Business, SharePoint Online and OneDrive [non-business]

from the author of SharePrep and DelinvFile


The following are based on an analysis of OneDrive for Business, SharePoint Online and OneDrive [non-business] on Win-7 thru Win-11.  Your systems may differ from these values.  You need to perform your own tests for verification.  See TestSPOL below.
  

OneDrive for Business  -  (OD4B)  -  Local Storage

There appears to be a limit of 249 characters for Folder and File names stored in the local OD4B Folder.  This limit includes the length for the OD4B Folder and its trailing backslash.  This limit applies to the length of Folder names plus the length of the File names.


by example, on one of my systems, the actual OD4B Folder is:


  C:\Users\Jim\OneDrive - MyComp\ 


This overhead equals 31 characters.  Subtracting 31 from 249 leaves 218 characters for storing your Folders and Files.


However, you must consider the length of the OD4B Folder name for all the systems that would Sync this data via the Microsoft Cloud.


by example, on another of my systems with a longer user ID, the OD4B Folder is:  


  C:\Users\jimlawler\OneDrive - MyComp\


This overhead equals 37 characters.  Subtracting 37 from 249 leaves 212 characters for storing your Folders and Files.


OneDrive for Business  -  (OD4B)  -  Cloud  Storage            [ SharePoint Online ]

There appears to be a limit of 260 characters for storing Folders and Files in the OD4B cloud.  As OD4B stores your data in a SharePoint Online library, this limit should also apply to SharePoint Online.


by example, the online OD4B Folder is:


  https://domain-my.sharepoint.com/personal/jiml_domain_onmicrosoft_com/Documents/


  where:
    "domain-my.sharepoint.com"   - is my test domain and
    "jiml_domain_onmicrosoft_com"   - is my account (with underscores)


Based on indirect information from Microsoft support, the 260 character maximum applies to the name beginning with "personal" and extending through the end of the Folder/File name.


Restated, the overhead in this URL equals 47 characters. 
Subtracting 47 from 260 leaves 213 characters for storing your Folders and Files.


Considerations

You must limit your use of OneDrive for Business to the lesser of these values.

From the above, I show:

     218 - Local for user ID "Jim"
     212 - Local for user ID "JimLawler"
     213 - Online for all users  


Therefore, I have to limit my Folder names plus File names to 212.  Exceeding this value will cause Sync problems for some of my systems.


NOTE - some SharePoint systems impose a limit of 128 characters for File names and 128 characters for Folder names.  You need to perform your own tests for verification.  See TestSPOL below.

 

Caution - if you are storing your data in the Shared with Everyone Folder, you must reduce your Folder plus File name length by the 21 characters that this Folder name consumes.

 

  

OneDrive [non-business]  -  (ODnB)

There appears to be a limit of 259 characters for storing Folders and Files in the ODnB Folder.


by example, the actual ODnB Folder is:


  C:\Users\lawlerj\OneDrive\


T
his overhead equals 26 characters.  Subtracting 26 from 259 leaves 233 characters for storing your Folders and Files.


Note - for multiple systems, you have to accommodate the system with the longest ODnB Folder name. 


Fortunately, unlike OneDrive for Business, you can designate alternate Folder names for OneDrive [non-business].

 

Background - testing

OneDrive for Business stores your data in a SharePoint Document Library via a Sync function. The Document Library can be in Microsoft's Cloud via SharePoint Online or on your own servers via SharePoint.

A major problem with OneDrive for Business is its Sync system. A leading cause for Sync problems relates to misunderstanding the length restrictions for File Names and Folder Names.



Available literature is not all that helpful. One can find a range of values such as:

     File names can have up to 128 - 256 characters
     Folder names can have up to 128 - 256 characters
     Folder name / File name combinations can have up to 250 - 260 characters.

The literature is lacking in any reasonable explanations as to where or how the lengths are computed and imposed.

Actually, Windows imposes a component (File name or Folder name) length limit of 255 characters on most File systems.



My SharePrep customers are faced with the need to know the maximum permitted length values for setting the Max Length field on SharePrep's Scan and Repair window. This represents the maximum length the user can use for their File and Folder names when migrating to SharePoint.

In order to help with this, I obtained a subscription for OneDrive for Business and experimented with its length limitations.

For this purpose, I created a program, TestSPOL, to create test records. I learned that I could create and Sync Files with a name length up to 213 bytes on three of my test systems and up to 212 bytes on the fourth system. Further, I could create Folder/File combinations with the same lengths. On my test systems, there were no additional restrictions for Folder/File names.

After several days of frustration, I could find no method for calculating the length available to the user. I found a partial explanation in an old Email from a SharePrep customer based on his conversation with a Microsoft support technician.

The technician indicated that only the last portion of the Site URL beginning with "personal" is considered in calculating the overhead for storing in the Microsoft cloud. 
 
The results from my experimenting is illustrated above.



TestSPOL

 

As stated above, your results will vary from mine.  I am making my test File generation program,  TestSPOL, available as a Free Utility that you can use to assist you in determining your Maximum length for your Folder and File names. 


[ TestSPOL ]  -  click to access TestSPOL webpage     


[ SharePrep ]  -  click to access SharePrep Home Page


[ OneDriveRx ]  -  click to access OneDriveRx Home Page


[ DelinvFile ]  -  click to access Delete Invalid Files Home Page

 
Assistance & Resources for Computing, Inc
Copyright © 2019-2024.  All rights reserved.
Revised: August 19, 2024