Click or drag to resize

ShareFactoryFindById Method

Find a share using his identifier, return null if not found

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static IShare FindById(
	IContext context,
	int id
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution
id
Type: SystemInt32
Id of the share to find

Return Value

Type: IShare
Return null if the share was not found or if the user within the context doesn't have enough right to access it
Examples

Find the share using his id

var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));   
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
    throw contextValidation.Exception;
}
var share = ShareFactory.FindById(context, 2);
if (share != null)
{
    Console.WriteLine("Share Id={0} was found, ObjectType: {1}, ObjectId: {2}", share.Id, share.ObjectType, share.ObjectId);
}
else
{
    Console.WriteLine("The specified share doesn't exist, or the current user within the context could not access it");
}
See Also