The file path is too long on save as template with content SPO

Dieter Tontsch (GMail) 962 Reputation points
2023-07-21T16:09:43.84+00:00

I am a bit confused. I am trying to save a SPO site as a template with content. It is a Modern Communication Site. I have set "DenyAddAndCustomizePages 0" in order to be able to use /_layouts/savetmpl.aspx

I do get several times this error, on different files. If i delete these files step by step I do get another and another file... it never ends. So, deleting all the files/folders in charge won't mache sense. But what wonders me is the fact that everywhere it is stated that max. file url length is 400 chars, but my files are way shorter.

The file path is too long: 'XXXXXXXXXXXXXXXXXXXXXXModules\Files\Freigegebene Dokumente\Xxxxxxxxxx\Betriebsvereinbarung und Richtlinie\Betriebsvereinbarung XXX NORD\Betriebsvereinbarung KuG 2021_XXX Nord.pdf'. Please make folder or file names shorter in the site and then try exporting the site again.

Depends on how you count, but the below real url of such a file (the one from the posted error message) is (starting from /sites) just e.g. 187 characters, not even 255.

https://xxxxxxxxxxxx.sharepoint.com/sites/XXXXXXXXXXXXXXXXXXXXXX/Freigegebene%20Dokumente/Xxxxxxxxxx/Betriebsvereinbarung%20und%20Richtlinie/Betriebsvereinbarung%20XXX%20NORD/Betriebsvereinbarung%20KuG%202021_XXX%20Nord.pdf

On the other hand it was not an issue to save that file, it also is no issue to restore it from SPO recycle bin, etc. So, what is now the limitation and why do I always get these error messages on files with below even 255 characters in total url length. Is there eventually a setting on site collection level for this?

kind regards,

Dieter

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,181 questions
{count} votes

Accepted answer
  1. Ling Zhou_MSFT 21,245 Reputation points Microsoft Vendor
    2023-07-24T03:06:46.5366667+00:00

    Hi @Dieter Tontsch (GMail),

    Thank you for posting in this community.

    According to your description, I did a test on my side. Based on my tests, the limit of the characters (including the folder path and the file extent name) is 157 when saving a SharePoint Online Site as template. You can choose to reduce the length of the file url.

    11

    Note: the whole limited is around 260 characters since the prefix “https://tenantname.sharepoint.com/sites/sitename” that hidden in the error message.

    If reducing the file url length is inconvenient or not what you are looking for, I would like to suggest you considering the following workaround to get rid of this limitation:

    1.Save the site as template without the contents.

    2.Copy your files from this site to your new sites by one of the following options:

    Please accept my sincere apologies for any inconvenience caused. If there is any other assistance I can provide, please feel free to let me know.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.