Send Mail in Moss 2007

SPWeb site = SPControl.GetContextWeb(Context);

string Msg = "";

SPDocDiscussionCollection discs = site.GetDocDiscussions("Document_Library_Name");

foreach (SPDocDiscussion disc in discs)
{
if (disc.CommentCount > 20)
{
Msg = "The file <A href='" + disc.DocUrl.ToString() + "'>" + disc.DocUrl.ToString() +
"</A> has received " + disc.CommentCount.ToString() + " comments.";

SPUtility.SendEmail(site, false, false, "e-mail_address", "Web Discussion Report", Msg);
}
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s