I have a document library with multiple content types of word templates.
In my event receiver I need to choose the right template based on a field of the modified/created list item.
Any ideas how to do that?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI have a document library with multiple content types of word templates.
In my event receiver I need to choose the right template based on a field of the modified/created list item.
Any ideas how to do that?
I've managed to do that as below:
...
SPDocumentLibrary lib = (SPDocumentLibrary)web.Lists["listname"];
SPContentType contentType = lib.ContentTypes["content-type-name"];
...
SPFile spf = web.GetFile(contentType.DocumentTemplateUrl);
...