Link to home
Start Free TrialLog in
Avatar of einarbrown
einarbrownFlag for Sweden

asked on

Send e-mail to admin of unused (never opend) sharepoint documents

I try to somehow get sharepoint to send an email to the administrator when a document is not used for a long time. Take for example 1 year. With "not used"  I mean not even opened.

As we got MOSS, I thougt of using a Policy, but it only has "Last modified" and "created" as dates to choose from, not "Last opened" or similar.

The link bellow shows me how to make a custome policy so I can connect the Due Date to another propertie, but I can´t find a "last opened" property.

http://blah.winsmarts.com/2008-10-Authoring_custom_expiration_policies_and_actions_in_SharePoint_2007.aspx

what I'm thinking about now is to create a custom date-property named "last opened" and then bring it to the current date when a document is opened. But I can not find an event that starts when a document is opened.

Summary:

1. Can you send e-mail to admin of unused (never opend) sharepoint documents out of the box in MOSS?
2. If not, is there an event that fires when an document is opend?
ASKER CERTIFIED SOLUTION
Avatar of Sushanta Sahu
Sushanta Sahu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of einarbrown

ASKER

Thanks!

That made me thinking of making a job that runs every night and looks for old documents.

Hope that can help me...
 SPList dokumentlist = website.Lists["Dokument"];

                foreach (SPListItem item in dokumentlist.Items)
                {
                    SPAuditEntryCollection auditcoll;
                    auditcoll = item.Audit.GetEntries();

                    foreach (SPAuditEntry entry in auditcoll)
                    {
                        if ((entry.Event == SPAuditEventType.AuditMaskChange || entry.Event == SPAuditEventType.View) && entry.Occurred.CompareTo(DateTime.Now.AddYears(-2)) == -1)
                        {
                            string emailBody = "This document has not been using for a 2 years: " + item.Web.Url + item.Url;
                            SPUtility.SendEmail(website, false, false, "admin@web.com", "Subject", emailBody);
                        }
                    }
                }

Open in new window

Thanks!