Click or drag to resize

ShareFactoryFindAll Method

Find all shares using the specified filters.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static IEnumerable<IShare> FindAll(
	IContext context,
	ShareQueryFilter filter
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution
filter
Type: AskiaPortalCmnShareQueryFilter
Filter to apply on query.

Return Value

Type: IEnumerableIShare
Return an object to iterate through the list of shares.
Remarks
This method is doesn't perform recursive search.
Examples

Find all shares available for the specified user and object type.

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

var shares = ShareFactory.FindAll(context, new ShareQueryFilter 
    {
        User = context.User,
        ObjectType = "some-type"
    });
foreach(IShare share in shares)
{
    Console.WriteLine($"Share Id={share.Id}: {share.ObjectId}");
}

Find all shares available for the specified object.

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

var shares = ShareFactory.FindAll(context, new ShareQueryFilter 
    {
        ObjectType = "some-type",
        OBjectId = 3
    });
foreach(IShare share in shares)
{
    Console.WriteLine($"Share Id={share.Id}: {share.ObjectId}");
}
See Also