SPDocDiscussionCollection.DeleteAll Method

NOTE: This API is now obsolete.

Deletes all document discussion objects in the collection.

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

Syntax

'Declaration
<ObsoleteAttribute("SPDocDiscussionCollection is deprecated", False)> _
Public Sub DeleteAll
'Usage
Dim instance As SPDocDiscussionCollection

instance.DeleteAll()
[ObsoleteAttribute("SPDocDiscussionCollection is deprecated", false)]
public void DeleteAll()

Examples

The following code example iterates through the Shared Documents library of every site in the current site collection and deletes all discussions associated with documents in the library.

Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim sites As SPWebCollection = siteCollection.AllWebs
Dim site As SPWeb

For Each site In  sites

    Dim discs As SPDocDiscussionCollection 
        = site.GetDocDiscussions("Shared Documents")
    discs.DeleteAll()

Next site
SPSite oSiteCollection = SPContext.Current.Site;
SPWebCollection collWebsites = oSiteCollection.AllWebs;

foreach (SPWeb oWebsite in collWebsites)
{
    SPDocDiscussionCollection collDocDiscussions 
        = oWebsite.GetDocDiscussions("Shared Documents");
    collDocDiscussions.DeleteAll();

    oWebsite.Dispose();
}

Note

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

See Also

Reference

SPDocDiscussionCollection Class

SPDocDiscussionCollection Members

Microsoft.SharePoint Namespace