EndoMint

Opinions are my own.

SharePoint forbids the fix it asks for

A team library in SharePoint had an old Word template. I had a finished replacement, a .dotx sitting in a folder in the same library, so I went to Library settings, Advanced settings, and pointed the Template URL at it. SharePoint answered with this:

Invalid template URL. The template must exist in the Forms directory of this document library. Create the template in the Forms directory, and then re-type the Web address. Note that you cannot move or copy a template into the Forms directory.

Read the last two sentences together. The template has to be in Forms. You have to create it there. You cannot move it there and you cannot copy it there. The finished file I already had is, by the rules of this message, the one file that can never become the template.

What the message is actually guarding

Every document library has a hidden folder called Forms, and the library's default template lives in it. Microsoft's own article, Set a custom template for a SharePoint library, says so plainly: "When a document or form library has a default file template, it is stored in the Forms folder of the library." The Template URL field accepts a path like Shared Documents/Forms/Watermark.dotx and nothing else. My file was in Shared Documents/General/Templates/, a couple of ordinary folders away, and that is all the error is about.

Fair enough as a rule. The wording is the problem. The same Microsoft article tells you to do the exact thing the error says is impossible: copy the file in Explorer, paste it into Forms, then type the new path into Template URL. The error and the help page cannot both be right, and it is the help page that works.

Fifteen years of the same question

None of this is new. The message turns up across SharePoint versions and tools:

Year Where What happened
2011 TechNet forum A Word file in Site Assets as the template. Answer: "that's not how you do it", use a content type
2011 Same thread Workaround: drop the .dotx into Forms with SharePoint Designer
2012 Blog, SharePoint 2010 The error fired because the file was named WDTMPL.DOTX in capitals. The extension check was case sensitive
2014 Same TechNet thread Workaround: open the library in Explorer and add /forms to the address
2020 Tech Community Where does New, Add template put the file? Answer: Forms, reachable through Designer or Explorer
2020 Same thread Reply: Explorer downloads the file instead of opening the folder. No answer
2023 Tech Community Can't see Forms at all. Answer: the library is classic, "avoid using those"

It also shows up in PnP PowerShell, as Apply-PnPProvisioningTemplate : Invalid template URL., when a site template carrying a custom library is applied to a new site. The 2012 case is the telling one: the author worked out that the message is thrown for any file the check doesn't like, including a valid template with an uppercase extension. The text says "Forms directory" whatever the real reason was.

The replace trap

Here is the part that makes it hard to swap one template for another. The Microsoft article has two notes that sit badly together:

  • "For SharePoint in Microsoft 365, the custom template must have a different filename than the default."
  • "If the default document template is named anything other than template.dotx, no default templates appear in the list or library."

So you cannot simply overwrite Forms/template.dotx with your finished file of the same name, and if you give it a different name, the library may stop showing a default template. The path that the error suggests, editing the template in place, means opening the old one and rebuilding your finished document inside it by hand.

The Explorer route the article describes also says you "must use Internet Explorer", a browser Microsoft has retired. SharePoint Designer, the 2011 workaround, is retired too.

What actually works

  1. In the modern library view, use New, then Add template, and upload the finished .dotx. It lands in Forms, which is the one way in that the error pretends doesn't exist.
  2. If the library has content types turned on, set the template on the content type instead (Library settings, the content type, Advanced settings, upload a new document template). Turning on content type management greys out the library's own Template URL field, which is what the 2011 answer meant.
  3. Name the file in lowercase. .dotx, not .DOTX.

The message is the bug

An error message has one job, which is to tell you what to do next. This one tells you the fix is forbidden, and Microsoft's own help page tells you to do it anyway. People have been asking the same question about it since 2011, and the answer has been a different workaround each time, two of them through tools that no longer exist.

If the rule is "templates live in Forms", the field should have an upload button, and the message should say "upload it here".

~ Mike