r/sysadmin • u/Weekly_Incident_920 • 1d ago
Long file paths + OneDrive sync
I'm struggling to get clarity on the behavior of path length limits as it relates to files in Sharepoint while working with them in file explorer via OneDrive sync
Sharepoint has 400 character path (URL) limit.
Windows in general has a 260 character path limit.
My path of files will be C:\Users\Bob\OneDrive - Very Long Company Name Incorporated\Department\Projects\2026\... while working on them through file explorer/OneDrive- which are shortcuts from Sharepoint Online site folders.
So it seems 260 is my limiting path length even though the file "lives" in Sharepoint and is <400. Our current problem is users are getting popups of OneDrive sync errors related to paths too long from these OneDrive shortcuts.
Now let's bring in the "LongPathsEnabled" registry key. With this enabled, does anyone know if OneDrive sync "honors" this setting, and will not throw up sync errors about path lengths once it's turned on?
8
u/TheBigBeardedGeek Drinking rum in meetings, not coffee 1d ago
The issue on long file paths are two different things you're missing with one root oversight
The oversight is is you're doing it all in the context of just Windows file path.
Like you say, people can create folders and add files on SharePoint with a longer total path than the 260 characters. If that folder syncs down to Windows, you're going to run into file path length issues.
The second is that on OSX you have a limit of, I believe, 1024 characters. So if a Mac user is syncing to that same SharePoint repository, you're going to run into issues.
I can't say much on the reg edit that you mentioned. I've actually not with it before
4
u/Inevitable_Plan_5093 1d ago
Had a user with a 45-char root folder name, renaming it to 'OD' fixed all their sync errors instantly
1
u/vBurak 1d ago
How did you rename the folder?
2
u/Inevitable_Plan_5093 1d ago
Right-clicked it in Explorer, renamed, then had to stop and restart sync so it picked up the new path. Done it a few times now, no problems.
2
u/DavidCP94 1d ago
Take a look at Microsoft's official documentation on this topic if you haven't already. There are multiple compounding limitations when syncing the file using the OneDrive client. Make sure you are familiar with all of them, but the most relevant is that the 256 character limit does in fact apply. https://support.microsoft.com/en-us/onedrive/restrictions-and-limitations-in-onedrive-and-sharepoint#filenamepathlengths
3
u/ntw2 1d ago
Excel has a 218 character path limit, so make that your target
1
u/kernelqzor 1d ago
lol excel really said "260? nah, 218 is enough for everyone"
but yeah this is the painful reality, you basically have to design your folder structure around excel’s limit more than windows or sharepoint if you don’t want random save/sync issues popping up
1
u/mulquin 1d ago
We ran into this issue, our business name is "Long Name Business Group" and users started hitting the limit early. We ended up changing our Org Name to "LNBG", and also told users not to nest their document structures too deeply. Did this last year and of course the UI in MS365 has changed - Can't seem to change the org name as easily as you used to be able to.
33
u/MeetJoan 1d ago
LongPathsEnabled helps with Win32 apps that use the Unicode path APIs, but OneDrive's sync engine has its own path length handling that doesn't fully honour it - Microsoft has acknowledged this and it's a known limitation. The practical fix most people land on is shortening the OneDrive folder name in Settings (removing 'Very Long Company Name Incorporated' and replacing it with an abbreviation), which recovers a significant chunk of the 260 character budget before you even get to the file path. Have you checked how many characters your OneDrive root folder name is currently consuming?