Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Visual Studio 2010 gives me this error,

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

by the folowing line of code.

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

The code is taken direcly from msdn

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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