none
send an email notification prior to two days before for a list item

    Întrebare

  • hi,


    I got created one custom list with cloumns like."AssignedTo","EmailId","DueDate".for a particluar item from this list prior to two day from "DueDate" i need to send an email alert to the particular item user.Can any one suggest how to proceed on this.


    Thanks & Regards, Krishna

    8 iunie 2012 13:54

Răspunsuri

  • In my scenario i will be having a list at root level.Where it contains column name"ExpDate".So the timer job which i scheduled to run every day will parse the list items and which ever date meets my requirement.I will be sending the mail to the respective user availble in that item using SMTP.


    Thanks & Regards, Krishna

    12 iunie 2012 13:52
  •   public override void Execute(Guid contentDbId)
            {

                try
                {
                    SPWebApplication webApplication = this.Parent as SPWebApplication;
                    SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];
                    SPWeb myweb = contentDb.Sites[0].RootWeb;
                                   SPList mylist = myweb .Lists["MyAlertList"];                SPListItemCollection items = mylist.Items;
                     foreach (SPListItem reqitem in items)
                    {
                        if (DateTime.Now.AddDays(5).Date.Equals(Convert.ToDateTime(reqitem["DateColumn"]).Date))
                        {
                            SmtpClient smtpClient = new SmtpClient();
                            smtpClient.Host = webApplication.OutboundMailServiceInstance.Server.Address;
                            MailMessage mailMessage = new MailMessage(mailfrom, mailto, mailsubject, mailbody);
                            smtpClient.Send(mailMessage);

                        }
                        else
                        {

                        }

                    }
                }
                catch (Exception ex)
                {

                }

            }

    Advantage:

    I no need to go for a work flow.

    Disadvantage:

    I think we cant attach the same timer job for multiple Site collections.


    Thanks & Regards, Krishna



    14 iunie 2012 03:48

Toate mesajele

  • This blogger appears to have captured it:

    http://sharepointgypsy.blogspot.com/2011/01/sharepoint-designer-workflows-3.html

    Else, checkout these hits:

    http://www.google.com/search?q=SharePoint+Designer+2010+Timer


    Steve Clark, MCTS | Twin-Soft.com


    8 iunie 2012 14:01
  • smart idea on using two work-flows.

    another alternate will be using Information Management Policy.

    HOW TO: Leverage SharePoint 2010′s Information Management Policies to trigger daily monitoring workflows…


    Please remember to mark your question as answered if this solves your problem.

    8 iunie 2012 20:40
  • I want to propose this as the answer, but his steps are not 100% followable, yet.  I tried to do it, but didn't get the same results.  I don't know if it's a permissions issue, or something else.  Looking forward to see how this pans out, as it would be revolutionary for SharePoint.

    Steve Clark, MCTS | Twin-Soft.com

    11 iunie 2012 14:09
  • I went with custom timer job approach.Its working fine.

    Thanks & Regards, Krishna

    12 iunie 2012 05:37
  • Does that mean a 2 list Workflow setup?  If not, please describe, such that a searcher a couple years from now will know what solved your issue.  Thanks!

    Steve Clark, MCTS | Twin-Soft.com

    12 iunie 2012 13:22
  • In my scenario i will be having a list at root level.Where it contains column name"ExpDate".So the timer job which i scheduled to run every day will parse the list items and which ever date meets my requirement.I will be sending the mail to the respective user availble in that item using SMTP.


    Thanks & Regards, Krishna

    12 iunie 2012 13:52
  • Timer job in SPD, Visual Studio, or other?

    Steve Clark, MCTS | Twin-Soft.com

    12 iunie 2012 17:54
  • I got created custome timer job using Visual studio.

    Thanks & Regards, Krishna

    13 iunie 2012 05:46
  • Krishna,  are you able to share your code here? How was your experience using timer job, pros/cons?
    13 iunie 2012 22:19
  •   public override void Execute(Guid contentDbId)
            {

                try
                {
                    SPWebApplication webApplication = this.Parent as SPWebApplication;
                    SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];
                    SPWeb myweb = contentDb.Sites[0].RootWeb;
                                   SPList mylist = myweb .Lists["MyAlertList"];                SPListItemCollection items = mylist.Items;
                     foreach (SPListItem reqitem in items)
                    {
                        if (DateTime.Now.AddDays(5).Date.Equals(Convert.ToDateTime(reqitem["DateColumn"]).Date))
                        {
                            SmtpClient smtpClient = new SmtpClient();
                            smtpClient.Host = webApplication.OutboundMailServiceInstance.Server.Address;
                            MailMessage mailMessage = new MailMessage(mailfrom, mailto, mailsubject, mailbody);
                            smtpClient.Send(mailMessage);

                        }
                        else
                        {

                        }

                    }
                }
                catch (Exception ex)
                {

                }

            }

    Advantage:

    I no need to go for a work flow.

    Disadvantage:

    I think we cant attach the same timer job for multiple Site collections.


    Thanks & Regards, Krishna



    14 iunie 2012 03:48