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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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
2  
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

 
discard

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.