1

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?

2
  • Is the event receiver running on items in the document library with the templates? Or is it running on items in a separate list? Commented Mar 12, 2020 at 16:51
  • It is running in the document library with the templates Commented Mar 12, 2020 at 17:07

1 Answer 1

1

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);
...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.