2

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

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. – SPArchaeologist Jan 18 '12 at 13:31
  • I think I tried the server-relative URL without success. – Tim Jan 18 '12 at 15:21
0

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:Files>
       <pnp:File Src=".\Assets\MyDocTemplate.docx" Folder="{sitecollection}/_cts/MyContentTypeName" Overwrite="true"/>
</pnp:Files>
<pnp:ContentTypes>
 <pnp:ContentType ID="MYGUID">
   <pnp:DocumentTemplate TargetName="{sitecollection}/_cts/MyContentTypeName/MyDocTemplate.docx"/>

        </pnp:ContentType>
</pnp:ContentTypes>

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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