Compartir a través de


Unable to edit files uploaded to document library where url length is more than 260 characters

As we all know there is a limitation in URL length as 260 characters for many reason and there are many articles from different specialties talks about it.

 

Recently I have come across a scenario where users are able to upload documents to the document library and sub folders, if we calculate the total URL length of the uploaded document, it is more than 260 characters, SharePoint didn't throw any error or warning message while uploading documents to the folders.

When users are trying to edit the same document by clicking on document link or edit using Microsoft Office Word in dropdown menu, we get below warning messages.

 

              "The URL for this file is too long for the application.  A temporary copy of this file will be opened on 

               your computer.  You must save this copy as a new file"

 

The document will be opened in Read Only mode and when we try to save the document back to same location we get

             "This file is read-only."

             "The document could not be opened for editing.  A Windows SharePoint Services compatible 

              application could not be found to edit the document."

 

 

Q1. Does SharePoint has 260 characters limit?

         Answer: Yes, it has the limit.

  

Q2. If SharePoint has 260 characters limit then does it throw any error/warning while uploading documents?

         Answer: Yes, it does throw warning message and terminate the upload process.

 

Q3. As mentioned SharePoint has 260 limit and it does not allow users to upload, then in what situation we get into the above issue (able to upload but not able to edit).

 

         Answer: As I have mentioned SharePoint has 260 characters restriction for both operations upload and edit. Sometimes users are experiencing issue only edit not while uploading.

Here is the explanation how restriction applied while uploading and editing.

For example my site URL is:  https://wfeone/ (14)
The document library I have created:  Queen/ (6)
Folder created under Queen:  0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/ (101)
Sub-folder : 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/ (101)
Sub-folder : 012345678901234567890123456789/ (31)

14+6+101+101+31 = 253

Complete length of the below URL is 253 characters
https://wfeone/Queen/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789/

Edit:
======
To edit the document, it must have only 6 characters in length (a.docx), if you upload any document which is 7 in length (ab.docx) cannot be editable. We get the following error message.

"The URL for this file is too long for the application.  A temporary copy of this file will be opened on your computer.  You must save this copy as a new file"

Upload:
=======
While uploading we use different mechanism to calculate length.
We do not count the site URL https://wfeone/ (14), the count starts from document library Queen/, so the total length would be 239 and you are allowed to upload a document which is 20 (0123456789012345.docx) in length, you cannot upload a document which is 21 characters.  You will get the following error message.

Error:
The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.
Troubleshoot issues with Windows SharePoint Services.

So, we have restrictions in both sides, while uploading and editing.  But it works in different way, site URL is not counted while uploading.

Q: Why SharePoint does not count the site URL while uploading ?

         Answer: Site URL length may vary based on zone URL added in Alternate Access Mapping (AAM).

 

Workaround:

==========

We can use the below SQL query to check length of the URL and manage the hierarchy.

select * from sites
select * from webs
                copy the SiteId from the above query and replace it with the below query.

select 'https://selvag/' + DirName + '/' + LeafName as url, LEN('https://selvag/' + DirName + '/' + LeafName) as urllength  from alldocs where siteid = '9BE4D0E8-ADC6-4C3F-946B-08D6748CC123' and LEN('https://selvag/' + DirName + '/' + LeafName) >200 order by urllength desc

We can create custom event handler which can count the site URL as well.
Some of the reference links are here …

https://www.sharepointjoel.com/Lists/Posts/Post.aspx?ID=111
https://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/e09fc8c1-b5f4-4ac6-9bd5-3ff8ebe06190

Comments

  • Anonymous
    September 29, 2011
    Thanks Selvagan. I have question. In the same doc library and sub folders I have two files with the same lenght. Yet i am able to open one but not the other. Any idea why?

  • Anonymous
    March 02, 2012
    Hi Vishal. Maybe the extension of the files is different.

  • Anonymous
    May 31, 2012
    We don't need a way to check the file extension length, we need a workaround for this clearly inept problem!  It is ridiculous to think that I should have to check this stuff and/or limit my file name length.  This goes down as another sharepoint epic fail in my book.

  • Anonymous
    March 08, 2013
    Work around: (2 methods), 1-check artifact out via the right click menu selection version history choosing the version you need. make changes to article, upon closing you should be prompted to save which will update sharepoint. 2-check out as in #1, save to a folder on your hard drive, go back to file location on sharepoint and do a document upload, should be prompted to overlay current document and check-in.

  • Anonymous
    March 19, 2013
    I made a (free) little web page that will shorten many SharePoint URLs that are too long: http://www.qa76.net/shortener It works for views, which is the problem about 2/3rds of the time. Put the view URL in there, click the button, and you get the short version to the same place. Click to copy to clipboard, and paste where needed. It doesn't work for full file names. A file name with full path is what it is. That you just have to shorten. But views get lots of very needless clutter added to them, and this page just strips it away.

  • Anonymous
    July 14, 2014
    Hello, I suggest you to download new Long Path Tool software that simply allows you to work easily on Long Path files. Thanks...

  • Anonymous
    April 06, 2015
    You can find a paid solutions in this article www.pathtoolong.com/.../filename-too-long-error-in-sharepoint. Anyway I was able to use a free trial version of the utility once, and it never appeared after it luckily

  • Anonymous
    February 18, 2016
    Long Path Tool is very potential to delete or rename long file, if you want you can use Long Path Tool