Exporter (0) Imprimer
Développer tout
Développer Réduire

SPWeb.Groups, propriété (Microsoft.SharePoint)

Windows SharePoint Services 3
Gets the collection of cross-site groups for the site.

Espace de noms : Microsoft.SharePoint
Assembly : Microsoft.SharePoint (dans microsoft.sharepoint.dll)

public SPGroupCollection Groups { get; }

Valeur de la propriété

An SPGroupCollection object that represents the cross-site groups.

The following code example uses the Groups property to return the collection of groups for a specified site in the current site collection.

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

using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("Website_URL"))
{
    SPGroupCollection collGroups = oWebsite.Groups;
    foreach (SPGroup oGroup in collGroups)
    {
        Response.Write(SPEncode.HtmlEncode(oGroup.Name) + "<BR>");
    }
}
RemarqueRemarque :

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 Best Practices: Using Disposable Windows SharePoint Services Objects.

Afficher:
© 2014 Microsoft