Automatically delete items from announcment list after they have expired MOSS 2007
I have a announcement list setup so users can post items they want to sell. Pretty much the same as a bulliten board. When they create a new item it allows them to put in an expiration date. However, after the expiration date expires the item still appears in the list. Is there any way to delete the itempermenantly or move it to the recycle bin after the expiration date?
January 18th, 2008 4:14pm
With default settings this is not possible, but you can do this with custom code. Maybe it's a good idea to create a view that only shows the items that are within the expiration date?
January 18th, 2008 5:02pm
How would I go about setting this up. Is there a view setting that allows only the ability to see non expired items?
January 18th, 2008 5:21pm
If you create a new view, you can setup a filter saying something like 'expiration date' (field)'is less then' [Today] It will only return the items where the expiration date later then today
January 18th, 2008 5:28pm
You want it to sayShow items when'Expires''is greater than or equal to'[Today](if you used less than today you would see everything that has expired)
January 21st, 2008 9:53pm
Would a Disposition Approval Workflow work in this situation?
January 21st, 2008 11:24pm
>>You want it to say>>>>Show items when>>'Expires'>>'is greater than or equal to'>>[Today] yes of course, my mistake..
January 22nd, 2008 10:58am
GRHS wrote: /snip/after the expiration date expires the item still appears in the list. Is there any way to delete the itempermenantly or move it to the recycle bin after the expiration date? Mart Muller wrote: With default settings this is not possible, but you can do this with custom code. Doesn't anyone else think that this default is a little shortsighted?? I think many people might expect that the default functionality of an expiry option would be to hide/archive/delete the expired item. I know I have at least one client who saw it this way. There's not even any basic settings options to control the behavior of expired items - you would need to activate an Information management policy for deletion based on the Expires date + X days.This could also include an instance of the aforementioned disposition workflow to invoke approval for the deletion. ps - if I'm not mistaken, the view filtering option that Mart suggested will also hide any items that have no expiry date defined, thereby forcing use of the Expires option on the list items. Something that may not be desired. It may be that certain Announcements are intended to be permanent.
February 11th, 2008 12:50pm
If you adda filter condition with the "or" operator (see below), all items with no expiry date should show up as well: Expires Is greater than or equal to [Today] or Expires Equals _______ (i.e. leave the form field blank).
February 11th, 2008 1:52pm
I tried adding two conditions to my query web part but when I try to leave the second condtion (blank) (ie left the form field blank) it will default to the current date. Any ideas?
June 17th, 2008 9:04pm
I have not been able to get that to work in a default content query web part. Using Expires Is greater than or equal to [Today] or Expires Equals _______ (i.e. leave the form field blank) from above in an Announcement filter does work however. You might need a third party CQWP to provide that type of filtering as it does not seem to work out of the box. Some good ones are https://store.bamboosolutions.com/ps-32-5-list-rollup-web-part-release-20.aspxand http://www.lightningtools.com/pages/lightning-conductor-web-part.aspxfrom what I've seen and heard. I haven't used either, yet. eric
June 17th, 2008 9:43pm
It seems like it is only "broken" when I try to set it up when I modify the webpart from the page. If I create a View then I do not have a problem with the filter setting the date to the current date.
June 17th, 2008 9:58pm
Correct, the view allows the date field to be empty, indicating a null or empty value. However the webpart sees no value as today's date for what ever reason. This leads me to belive that you would have to recode a new content query web part to allow no value to equal null or experiment with more robust 3rd part content query web parts that provide better aggregation and filtering options than the out of box product.. eric
June 17th, 2008 10:11pm
Don't you just need to set an Expiration Policy (in Information management policy settings) for the list/library?For example, for Announcements: Open Announcements List Then follow this sequence: Settings | List Settings | Permissions and Management | Information management policy settings | -Define a policy -OK -description -policy statement -Enable Expiration -A time period based on the item's properties -Expire -plus 0 days -Perform this action -delete -OK
September 25th, 2008 3:44am
Hi all,I have much the same question, however slightly different. So I'll post here.To answer the OP question, I defined a policy for the list to expire all items after 30 days, and the action was to delete. As suggested by Betty B. Apply that policy to your list.The site collection expiration manager should clean these up for you when you have scheduled it (daily, weekly). You will notice in the timer job that the application is N/A. That's fine as it does all collections, you don't define which collections to work though.My question to the greater SharePoint knowledge base out there is:Q: Does a custom list policy override the existing expires field in a list?I have an Announcements list where the end-user can enter an expiry date, but I also have the defined expiry policy in the background set to delete any item 30 days after it is created. The problem is:- The user sets a date earlier than the custom policy, is isn't deleted- The user sets a date after the custom policy, is isn't valid as the item will be deleted.Logical, I know :DIf my assumption that the custom policy overrides the expiry field, then my second train of thought for this week is to remove the custom policy, and set the default value for the expiry date field to be a calculated column which would contain: =[Today]+30. that way the date is already set for those who are too lazy to set a date, and for users who want to change it, they can.I just hope the Microsoft defined expiration policy manager picks it up and deletes. Testing today.
May 25th, 2009 5:44am
Yes, the IMP (Information Management Policy) will delete the List Item on the schedule you have set for the IMP. However, you have two choices OOTB Start Date or Due Date.But, I have never used due date and always create a WF to Notify the owner, give them a choice to republish, delete or archive... Also, best Practice would be to have used Content Types and applied the IMP to the CType. Also,listen toeverything Mart has to say...Have a great weekend :)-IvanIvan Sanders http://linkedin.com/in/iasanders http://dimension-si.com/blog
May 25th, 2009 10:11pm
Betty B, your solution worked for me. What I didn't realise is a few things:- Expiry field on an announcements list is a compulsary field to the lsit. You can't get rid of it.- Expiry field is just a date field. It doesn't actually do anything.I removed my site collection policy to remove all items after 30 days and did this:- Changed the expiry field to be compulsary (always have an entry)- Change the expiry field to be a calculated field. Typed in: "=Today+30" without the quotes- Those steps Betty B said aboveBecause the field is compulsary, it has to have an entry (therefore not blank - which if it is blank gives errors in your system error log when the site wide expiration policy fires from MS)People are then able to enter their own date, or accept my 30 days from now date.Cheers. I have suggested Betty B's post as the solution. I've learnt something today, time to go home :)
May 27th, 2009 4:29am
You need the solution that is given by Betty. And for this to work you need to make sure that the Sharepoint Timer Service is running. There is a Timer Job for Expiration Policy that runs at a given time daily or as per the settings that can be configured in the Cetnral Admin Application. This Job doesn't executeif theSharePoint Timer service is not runninghencethe expiredrecords won't be removed from the list. Ifeverything is properly setup as is mentioned here you should see theexpired records moving to the SharePoint Recycle Bin every time the Expiration Policy timer job runs. Settings | List Settings | Permissions and Management | Information management policy settings | -Define a policy -OK -description -policy statement -Enable Expiration -A time period based on the item's properties -Expire -plus 0 days -Perform this action -delete -OK Thanks,Raza .Net Developer
June 13th, 2009 3:13am
I did the above steps twice in one week but still the announcement list item does not get expired and deleted... What to do?
September 1st, 2009 9:43am
worked for me - thanks!
December 17th, 2010 4:13am