Share via


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.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPDocDiscussion

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

Syntax

'Declaration
<ObsoleteAttribute("SPDocDiscussion is deprecated", False)> _
Public Class SPDocDiscussion
'Usage
Dim instance As SPDocDiscussion
[ObsoleteAttribute("SPDocDiscussion is deprecated", false)]
public class SPDocDiscussion

Examples

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.

Dim site As SPWeb = SPControl.GetContextWeb(Context)
Dim Msg As String = ""
Dim discs As SPDocDiscussionCollection = site.GetDocDiscussions("Document_Library_Name")
Dim disc As SPDocDiscussion

For Each disc In  discs

    If disc.CommentCount > 20 Then

        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)

    End If

Next disc 
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);
   }
}

Thread Safety

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

See Also

Reference

SPDocDiscussion Members

Microsoft.SharePoint Namespace