views:

1497

answers:

4

Hi,

Which is the best way to display a custom form for each new document being added to a specific document library?

I want the user to have some control over some actions that adding the document will cause - specifically, tasks created for users in a Task List, which the contributing user will have to OK before committing.

Is the best way to do this via a Workflow or an event handler?

Regards Moo

A: 

For SharePoint server 2007:

A combination of a specialised content type and an event handler will give you the most control of the process (easier to debug too). A workflow is best for "easy" actions and is harder to make complex actions happen.

A workflow allows for more flexibility in assigning the workflow to different libraries by site admins.

Roll your content type and event handler into a feature that can be deployed. Assigning the content type to a list will allow you to take any data created by the standard form (remember you can create custom fields for really complex/custom data entry) and take any action required, including creating tasks based on the item.

Nat
A: 

Thanks for the answer, thats the route I was investigating but unfortunately I haven't found a way to make it work for Document Libraries - only Lists.

The problem I have come across is that aving a SPUtility.Redirect in the ItemAdded, ItemAdding, ItemCheckingIn or ItemCheckedIn event on the document library doesn't do anything at all, because there is no page related to the events - its all backend code being fired that is not linked to a web context, because its not the webpage doing the heavy lifting at that point but the Office integration.

All of the examples I have come across seem to rely on the fact that the EditForm.aspx or NewForm.aspx page is being displayed at the time the event is fired, which of course is not the case here.

This also leads to the problem that I cannot extend the EditForm.aspx or the CheckIn.aspx page to do what I want either, because Office 2007 circumvents both of these.

So, the only option left open to me at the moment is doing it through a workflow :/

Any further tips would be fantastic.

Moo
A: 

I may not understand your question, but is this close to what you're trying to do?

http://msdn.microsoft.com/en-us/library/ms550037.aspx

If not, in what way does this come up short?

Jason Weber
A: 

Hi, A new "Content Type" with its New Form url set to the appropriate value should do the trick. Unfortunately you may not be able to achieve what you are trying to with an Event Handler or a Workflow. You would ideally want the form to show up as soon as the user adds a new item to the library and a custom content type will do the trick.

  1. Create a new Content Type. (Derive it from the existing Content Type)
  2. Remove the default content type from the doc library.
  3. Using the Object Model to set the New Form url to an aspx page or an Infopath form you've created.

Kind regards,

SharePoint Newbie