Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Workflow in site definition

  Asked By: Fallon    Date: Mar 20    Category: Sharepoint    Views: 1462

I have been tasked with making sure a custom workflow I wrote in Visual Studio
is associated with the pages library of any site that is created upon creation
and any document library as it is created. I have a general understanding of
how to do this, but I have not found an good example of how to do this. Any
suggestions on ways to accomplish this? I was thinking of adding it to a custom
site definition that I have written, but am unsure of how/where it should be



11 Answers Found

Answer #1    Answered By: Sheryl Velez     Answered On: Mar 20

You need any write a custom site  definition for this. Feature Stapling would
be good  enough.

Answer #2    Answered By: Alexandra Lewis     Answered On: Mar 20

Is there an event you can trap for that (using an Event Receiver)?

Answer #3    Answered By: Himanta Barthakur     Answered On: Mar 20

From what I have read, the only way I could add an event receiver is any time an
item is added. I'm concerned about the impact that attaching the workflow  on
every item added or changing event would have.

Answer #4    Answered By: Mansi Revenkar     Answered On: Mar 20

What if you just associate the workflow  with the appropriate content types?
That should take care of any library  that uses them.

Answer #5    Answered By: Lizette Mcconnell     Answered On: Mar 20

create a custom  content type and associate workflow  with it. Use this content
type in your doc library.

Answer #6    Answered By: Rosanna Parrish     Answered On: Mar 20

Do you know of any where I can see examples of this being done? I'm supposing
this means I will replace my association page with code?

Answer #7    Answered By: Kalash Karmakar     Answered On: Mar 20

It doesn't need to be a custom  content type.


Go to the second section (the one about Site Content Types).

Answer #8    Answered By: Mauricio Tanner     Answered On: Mar 20

I am not following your post from the beginning but it is certainly doable by
associating workflow  at the content type level. This blog explains how to do it
programmatically, however it can be associated with no code but you have to
google it around.


Plus, you do no not need to change assoication page.

Answer #9    Answered By: Gina Freeman     Answered On: Mar 20

Can you create a custom  list, attach the SPListItem event receivers to it and
then save the list as a template? Assuming you can code the event receivers to
be dynamic (don't code them to a specific URL) then it seems like this will
work. Then, when you create new lists from that template they will already have
the correct events attached. This isn't a workflow, specifically, but
fundamentally that's really all the workflows are: Windows workflow  Foundation
in event receivers.

We created  a site  with lists that have event receivers attached to them. When we
save the site as a template and create new sites from that template the lists
all still have the event receivers attached and everything works perfectly.

This works for site templates so I wonder if it can work for individual list
templates as well...

Answer #10    Answered By: Tyrell Nash     Answered On: Mar 20

The workflow  is already written and in production. The shareholders of the site
decided to have it "hands off" because the governance of enforcing it be added
to every page and document library  was beginning to give them quite a headache.

Didn't find what you were looking for? Find more on Workflow in site definition Or get search suggestion and latest updates.