Getting group data

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can get a group as a GroupInfo object:

 

[C#]

 

using CMS.Community;

 

...

 

        string groupName = "customGroupName";

        string siteName = "CommunitySite";

 

        // Get group object by GroupID

        GroupInfo gi = GroupInfoProvider.GetGroupInfo(1);

 

        // Get group object by group code name and site name

        GroupInfo gi2 = GroupInfoProvider.GetGroupInfo(groupName, siteName);

 

The following sample code shows how you can get a DataSet containing all groups in the system with a GroupID greater than 5, ordered by their Display name:

 

[C#]

 

using System.Data;

using CMS.Community;

 

...

 

        string where = "GroupID > 5";

        string orderBy = "GroupDisplayName";

 

        // Get DataSet of group objects

        DataSet ds = GroupInfoProvider.GetGroups(where, orderBy);

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_group_data.htm