Click or drag to resize

GroupFactoryFindAllReachableRecursively Method (IContext, IGroup)

Recursively find all non-deleted groups reachable by the specified group.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static IEnumerable<IGroup> FindAllReachableRecursively(
	IContext context,
	IGroup group
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution
group
Type: AskiaPortalCmnIGroup
Group for who to find reachable groups.

Return Value

Type: IEnumerableIGroup
Return an object to iterate through the list of groups.
Examples

Recursively find all groups reachable by the specified group.

var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));   
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
    throw contextValidation.Exception;
}

var targetGroup = GroupFactory.FindById(context, context.User.GroupId);
var groups = GroupFactory.FindAllReachableRecursively(context, targetGroup);
foreach(IGroup group in groups)
{
    Console.WriteLine($"Group Id={group.Id}: {group.Name}");
}
See Also