zoukankan      html  css  js  c++  java
  • SharePoint 报错: The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less

    由于文件名太长引发的错误。

    报错信息: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.)

    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:  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.

    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 '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

  • 相关阅读:
    php 实现店铺装修3
    脸如何瘦
    第一次约会看电影的细节 了解好男人的标准看他是否合格
    14细节 看男人爱你到什么程度:第一次约会时他沉默寡言
    男生第一次约会穿什么?
    提高心理素质 2
    心理素质差的原因
    如何提高心理素质
    不适合做老婆的女人,五大特质(转载)
    心理素质差的表现
  • 原文地址:https://www.cnblogs.com/dadongzuo/p/2887419.html
Copyright © 2011-2022 走看看