Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Event triggers

  Asked By: Eddy    Date: Jul 13    Category: Sharepoint    Views: 1012

Can someone explain how to trigger code to run on a particular event in WSS?

Example: I have a simple for sale list. When an item is added, I create a custom calculated field called "Expires" and set it to the creation date + 14. The item should remain on the list for fourteen days. After that, I want to delete it from the list automatically. So I need an event to trigger off of, and a way to execute code to delete it. I have not seen any good examples that explain how to add code to a WSS site in this way.

Perhaps there is a good article or book that discusses this?

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Anibal Baird     Answered On: Jul 13

Events aren’t raised for WSS lists, however the are raised for document libraries.

IMHO the best approach for what you want is to develop a simple  console app that, when executed, checks the list  using the SharePoint API and removes items that have expired based on your rules. Then you’d deploy this EXE to the SharePoint box and schedule it to run  every day using the Windows Task Scheduler.

 
Answer #2    Answered By: Karla Morrison     Answered On: Jul 13

I hadn't thought of using an external application, but your suggestion sounds like it would be just the thing I need. Thanks!

Could you point me to a trivial "Hello World" example of how document library events can be used? I see a lot of possibilities for this, particularly in building workflow applications.

 
Answer #3    Answered By: Patricia Richardson     Answered On: Jul 13

Does it need to be deleted? Why not just stop showing it?

 
Answer #4    Answered By: Laura Walker     Answered On: Jul 13

Mainly just housekeeping. If it's no longer needed, then get rid of it.

Sounds simple, so why can't I do this at home?

 
Answer #5    Answered By: Cory Brooks     Answered On: Jul 13

There was an article  in MSDN mag that talked about creating a recycle bin for document libraries:

msdn.microsoft.com/.../default.aspx

However, a search for “document library event  sink” on Google/MSN will give you plenty of examples.

FWIW, I don’t like the solution in the MSDN mag. It creates MASSIVE bloat to your repositories and it’s not a true recycle bin. No way to get that until v3.

 
Didn't find what you were looking for? Find more on Event triggers Or get search suggestion and latest updates.




Tagged: