0

Anyone implemented a solution on SharePoint 2013 were by an email is sent to the last person who modified a document >X days?

We are trying to tidy up our document storage when we move to SharePoint 2013. We can't use the document retention solution (we don't believe) because some docs need to stay for long periods of time and some don't.

We started thinking we could have a reusable workflow to do it as we don't want to add any columns to the document library (using calculated fields to add X days to the modified date) and we could then attach that workflow to every document library.

Essentially if a document isn't modified for 90 days it emails the person to say "should this be on here"

Any best practices out there?

2 Answers 2

0

You may create a Timer Job that runs DAILY, and will compare the current date and the modified date. if it's > 90 days then you will send an email.

Please check this article on how to create a timer job, basically it's just a class that inherits SPJobDefinition How to Create Timer Job

Here's a snippet on how to send an email

public bool SendMail(string smtpAddress, string subject, string body, bool 

isBodyHtml, string from, string to, string cc, string bcc) {  

        bool mailSent = false;  

        SmtpClient smtpClient = null;  

        try {  
            // Assign SMTP address   
            smtpClient = new SmtpClient();  
            smtpClient.Host = smtpAddress;  

            //Create an email message   
            MailMessage mailMessage = new MailMessage(from, to, subject, body);  
            if (!String.IsNullOrEmpty(cc)) {  
                MailAddress CCAddress = new MailAddress(cc);  
                mailMessage.CC.Add(CCAddress);  
            }  
            if (!String.IsNullOrEmpty(bcc)) {  
                MailAddress BCCAddress = new MailAddress(bcc);  
                mailMessage.Bcc.Add(BCCAddress);  
            }  
            mailMessage.IsBodyHtml = isBodyHtml;  

            // Send the email   
            smtpClient.Send(mailMessage);  
            mailSent = true;  
        } catch (Exception) {  
            mailSent = false;  
        }  

        return mailSent;  
    }  

`

You may also refer to this article

0

If you have access to a workflow engine, possibly standard SP workflows but certainly with a 3rd party tool like Nintex, this would be quite easy to set up as a list workflow.

In fact if your 90 day policy was consistent across a lot of libraries, you could look into having a single master workflow set up as a scheduled site workflow (independent of any list), and then having a config list that tells the scanner which lists to scan for potential dead documents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.