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

Posted on 2010-01-04
Last Modified: 2012-05-08
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.

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.


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?
Question by:einarbrown
    LVL 6

    Accepted Solution

    I think the audit logs have the details stored. Check the audit logs if they can be of any help. Generally any event i.e, opening, editing, deleting etc is being captured in the audit logs. But the audit log should be enabled from Central Admin as well as from the site collection administration properties.

    Let me know how it goes.
    LVL 6

    Author Comment


    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, "", "Subject", emailBody);

    Open in new window

    LVL 6

    Author Closing Comment


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now