Actualización 2018: este artículo fue escrito en 2015 y esta solución sólo ha sido comprobada en entornos SharePoint 2010 y SharePoint 2013 OnPremise. Para aplicar esta solución en SharePoint Online o para cualquier aclaración no dude en contactar con nosotros.
Folder and file names restrictions
First of all, be aware of current limitation: the maximum length of a filename or folder in SharePoint is 128 characters (unicode), and the total folder / subfolder(s) and file name allowed length is 260 character.
From the Technet Microsoft site we can see the official limits (these are SharePoint 2010 values, they are the same for the 2013 version):
- 260 Unicode (UTF-16) code units the characters in a full file path, not including a domain/server name.
- 256 Unicode (UTF-16) code units the characters in a full folder path, not including the file name and the domain/server name.
- 128 Unicode (UTF-16) code units characters in a path component, that is, a file or folder name.
Bad structure design
Well, for sure it is not a good practice to have this kind of folders structure, the proper solution is to redesign your libraries and/or site structure. But this may not be suited for every scenarios.
A few weeks ago we were working on a project where the client wanted to keep the same folders as the ones existing in their legacy system. Unfortunately the folder paths were way bigger than the limit supported by SharePoint and modifying the structure was not an option for them.
Workaround: how to bypass this limit
Here is the trick: we used Folder Content type. The idea is to use shorter folder names, and display a different column that is not the proper name.
To do so we create a new content type based on the folder content type; we only add a column «Folder Title», name is the real physical path name.
It is also helpful if you want to display special characters not allowed in folder path.
Obviously it would be too easy if it would work just like that. You will have to customize your views with the help of JS Link or xsl if you are working on SharePoint 2010. We want to display the «Folder title» when it exists and otherwise, the name. Thus the document name will be displayed along with folder titles. The physical structure will remain short.