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 must be URL encoded so many characters count as 3 characters. This means the limit can be reached faster than expected.
Sometimes it isn't clear why errors occur when the path is appropriately small. Assume the following environment:
- Domain: domain.com
- User: firstname.lastname@example.org
- Folder: /folder
- File: this & that.docx
It is reasonable to assume 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:
When applying file permissions, we 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, resulting in the following file path URL:
This is 112 characters, when the file appears to be only 24 characters.
Solution: Use the Advanced Option in MigrationWiz to enable the use of 400 characters for the file path name. For additional information, see What would I use the Advanced Option IncreasePathLengthLimit-1-for?