Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fire code upon creation of a SharePoint list?

Tags:

sharepoint

I'm aware of the event receivers on a list for items added etc. However, I have not found a way to fire code upon the creation of a list.

What I'm trying to do is associate a workflow with a list when the list is created (by the user through the UI).

Anyone any ideas?

thanks.

like image 222
Donaldinio Avatar asked Dec 23 '22 12:12

Donaldinio


1 Answers

There are a couple of routes you can take...

You can write your own list definition where you have defined the workflow association - That way all lists created based on your list definition, will contain your workflow on default.

Or... depending on your workflow... write an EventReceiver your attach to all lists of the type you wish to attach your workflow to (can easily be achieved tru a feature) and have your event receiver associate the workflow when the first item is added.

or you can associate the workflow to the contenttype used in the list (your own contenttype you attach to your own list definition or a default SharePoint contenttype)

I don't know the rest of your solution, so it's defficult for me to suggest the best solution for you.

What I (almost) always do, is write my own list definition - That way I can avoid problems like this, now or in the future.

like image 179
Brian Jensen Avatar answered Jan 10 '23 03:01

Brian Jensen