The Path Length Limit of 400 chars in SharePoint Online
By Anatoly Mironov
This post is my summary and my conclusions on the Path Length Limit in SharePoint Online and OneDrive.
How the path length is calculated
Path Length is not the same as the URL length. It is the relative Url.
/sites/site-url/documenlibrary/folder1/folder2/filename.fileextension
Calculations rules
- Only the server relative url part is counted. The “https://[tenant].sharepoin.com” has no impact on that. It starts from the foward slash: “/sites” (or /teams).
- An encoded value such as a blankspace (%20) is treated as one character, not three.
- A unicode character, and an emoji is treated as one character. Good news for Non-English Names.
- Url Parameters, like “?Web=1” are not calculated.
- The site url and the document library url is taken into account
- All slashes are included
- A file extension is also included, and even the dot, e.g. “.docx”
Other related information
- A site url and a group name can only be 64 characters max.
- The path in the “Copy Link” is much shorter than the “real” path
- There is no limit (as of time of writing - 2019-10-30) on the folder name length (other than the bigger limit of 400 characters), I had no issues to add a folder name with 312 characters.
https://[tenant]sharepoint.com
/:w:/s
/[long-site-ur]/ETWAEtIJiltJtW7uAND42doBeXOMCpxmHRws55m_nNlEcA
A calculation example
Those are parts that are counted in the Path Length
Recommendations for Folder-heavy document management
I don’t want to discuss whether to folder not to folder. On that topic, my favorite is the slide deck with the same name by Bobby Chang: To Folder or Not To Folder. For those who need to use folders I would recommend:
- Try to have a short site url/group name
- Try to have a short document library url. Why not creating just “docs” instead of “Our very important documents”? Note, that I am talking about the url, not the display name. The trick is to call it “docs” (or some other short word) initially (which will turn to the url), and then you can name it to whatever you please.
- Even if you use folders, try to flatten the structure.
- Use shorter folder names
- Use shorter file names.
Further Reading
- Ultimate Guide To SharePoint Size and Usage Limitations.
- Hugo Bernier. Mind the URL Length.
- Rene Modery. Increased Path Length for Files in SharePoint Online and OneDrive
- ShareGate Docs. The specified file/folder/item names are too long.
Comments from Wordpress.com
liam - Nov 1, 2019
Use “Long Path This very useful if you are having problems in deleting, unlocking, copying and even renaming files, also very easy.
Have you tried ’long path tool’? it’s very helpful for me.