Visual Studio 2010 gives me this error,

urlOfFile - Parameter name: Specified value is not supported for the urlOfFile parameter.

by the following line of code.

// Specify a document template.
templateDocumentCType.DocumentTemplate = documentTemplate;

The code is taken directly from msdn

2 Answers 2


Through the stacktrace I found out the error was inside Microsoft.SharePoint.SPFileCollection.get_Item(String urlOfFile). And the solution was to use an absolute url instead of only the filename for the property setter.

  • 4
    To be more precise: the URL should be either an absolute URL, a server-relative URL, or relative to the content type resource folder for the content type.
    – SPArcheon
    Jan 18, 2012 at 13:31
  • I think I tried the server-relative URL without success.
    – Tim
    Jan 18, 2012 at 15:21

I had the same problem when remote provisioning my SP Online via xml template and pnp engine.

I finally used the absolute URL using {sitecollection}.

       <pnp:File Src=".\Assets\MyDocTemplate.docx" Folder="{sitecollection}/_cts/MyContentTypeName" Overwrite="true"/>
 <pnp:ContentType ID="MYGUID">
   <pnp:DocumentTemplate TargetName="{sitecollection}/_cts/MyContentTypeName/MyDocTemplate.docx"/>


Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.