Why am I getting Path Too Long errors when migrating to OneDrive?
When migrating to OneDrive, the path length limitation is a common issue. OneDrive has several limitations:
- A given element (file or folder) cannot be more than 128 characters.
- A total file path including full path + file name cannot be more than 260 characters.
- All of them have to be URL encoded, so many characters count as 3 characters, so the limit can be reached faster that we first expect.
It is, however, not always clear why the errors arise when the path actually seems small. So let’s assume the following environment:
- Domain: domain.com
- User: firstname.lastname@example.org
- Folder: /folder
- File: this & that.docx
One would assume that the file is /folder/this & that.docx, 24 characters.
However, when using the API, we have to use the complete OneDrive path, which is this case would be:
/personal/test_user_domain_com/Documents/folder/this & that.docx
This is 64 characters.
We also have to URL encode this string:
We're already at 80 characters out of the 260-character limit.
When applying file permissions, we need to use the full file path to the file, which is even longer:
https://domain-my.sharepoint.com/personal/test_user_domain_com/Documents/folder/this & that.docx
Then we URL encode this, ending up with the following:
This is 112 characters, when the file appears to be only 24 characters.
Use the Advanced Option in MigrationWiz to enable the use of 400 characters for the file path name. For more information, see KB008008.