由于文件名太长引发的错误。
报错信息: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.)
Here is the explanation how restriction applied while uploading and editing.
For example my site URL is: http://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
http://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 http://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.
select * from sites
select * from webs
copy the SiteId from the above query and replace it with the below query.
select 'http://selvag/' + DirName + '/' + LeafName as url, LEN('http://selvag/' + DirName + '/' + LeafName) as urllength from alldocs where siteid = '9BE4D0E8-ADC6-4C3F-946B-08D6748CC123' and LEN('http://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 …
http://www.sharepointjoel.com/Lists/Posts/Post.aspx?ID=111
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/e09fc8c1-b5f4-4ac6-9bd5-3ff8ebe06190
转自:http://blogs.msdn.com/b/selvagan/archive/2009/12/06/unable-to-edit-files-uploaded-to-document-library-where-url-length-is-more-than-260-characters.aspx