locked
Get Custom content type DefaultTemplate when creating item RRS feed

Answers

  • Ok, I've figured it out myself:

     

    Code Snippet

     

    SPFile file = web.GetFile(ContentTypeManager.ExcelFileCT.DocumentTemplateUrl);

    //Create file from template here

    newFile = baseFolder.Files.Add(fname, file.OpenBinary());

     

     

    easy, huh?

     

    Friday, September 14, 2007 8:49 AM

All replies

  •  

    So the current SPWeb's object has a ContentTypes property. This property returns a collection of SPContentType objects. Each of these in turn has a DocumentTemplateUrl.

    Ed Hild

    Friday, September 14, 2007 12:00 AM
  • Ed,

     

    I've covered that in my post: I already have the url of the file. My question was how to create a file based on that template. Mening how do I use the DocumentTemplateUrl...

     

    Friday, September 14, 2007 6:38 AM
  • Ok, I've figured it out myself:

     

    Code Snippet

     

    SPFile file = web.GetFile(ContentTypeManager.ExcelFileCT.DocumentTemplateUrl);

    //Create file from template here

    newFile = baseFolder.Files.Add(fname, file.OpenBinary());

     

     

    easy, huh?

     

    Friday, September 14, 2007 8:49 AM