ClientContext context = new ClientContext("http://SiteUrl");
SP.List list = context.Web.GetCatalog(ListTemplateType.WebPartCatalog);
BasePermissions perm = new BasePermissions();
perm.Set(PermissionKind.ManageLists);
ConditionalScope scope =
new ConditionalScope(context,
() => list.ServerObjectIsNull && context.Web.DoesUserHavePermissions(perm).Value);
using (scope.StartScope())
{
context.Load(list, l => l.Title);
}
context.ExecuteQuery();
label1.Text = scope.TestResult.Value;
if (scope.TestResult.Value)
{
label1.Text = list.Title;
}
SP.List list = context.Web.GetCatalog(ListTemplateType.WebPartCatalog);
BasePermissions perm = new BasePermissions();
perm.Set(PermissionKind.ManageLists);
ConditionalScope scope =
new ConditionalScope(context,
() => list.ServerObjectIsNull && context.Web.DoesUserHavePermissions(perm).Value);
using (scope.StartScope())
{
context.Load(list, l => l.Title);
}
context.ExecuteQuery();
label1.Text = scope.TestResult.Value;
if (scope.TestResult.Value)
{
label1.Text = list.Title;
}
No comments:
Post a Comment