SPDocDiscussion Class

NOTE: This API is now obsolete.

Represents all the discussions associated with a single document that has been discussed in a document library.


Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

[ObsoleteAttribute("SPDocDiscussion is deprecated", false)]
public class SPDocDiscussion

The following code example iterates through the collection of document discussions for a document library and sends e-mail notification to a specified address if the total number of comments made about a document is greater than 20.

This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint and Microsoft.SharePoint.Utilities namespaces.

SPWeb oWebsite = SPContext.Current.Web;
string Msg = "";
SPDocDiscussionCollection collDiscussions = oWeb.GetDocDiscussions("Document_Library_Name");

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

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.