Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Create a list with associated workflow from a list template.

$
0
0

Hi,

I have a calendar list with two workflows and I saved it as list template. Also I have an event receiver which creates a list based in this list template I created, but I noticed that the list is created without workflows. If I create the list using the list template using SharePoint it does it with the workflows but my event receiver does not.

Here is my code:

if

(list == null){

web.AllowUnsafeUpdates =

true;

var lstTemp = web.Site.GetCustomListTemplates(web);

var template = lstTemp[listTemplate];

var listId = web.Lists.Add(listName,string.Empty, template);

list = web.Lists[listId];

list.Title = listName;

list.OnQuickLaunch =

false;

list.Update();

web.AllowUnsafeUpdates =

false;

}

Thanks anyway.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>