You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling LoadAsync for all lists of a web, will not return role assigments for any of the lists.
Steps to reproduce
await ctx.Web.LoadAsync(
w => w.Lists.QueryProperties(
l => l.Fields.QueryProperties(
p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title
),
l => l.Title,
l => l.HasUniqueRoleAssignments,
l => l.RoleAssignments.QueryProperties(
ra => ra.PrincipalId,
ra => ra.RoleDefinitions.QueryProperties(
rd => rd.Id,
rd => rd.Name
)
)
));
Expected behavior
After calling this method, for any of the returned lists/libraries the RoleAssignment property contains no records:
foreach(var reqList in ctx.Web.Lists.AsRequested())
{
foreach(var ra in reqList.RoleAssignments.AsRequested())
{
// we will never get here since RoleAssigments contains zero records
Console.WriteLine($"{ra.PrincipalId}");
}
}
Incredibly enough, this instead WILL return the role assigments (simply not querying the "Fields" property)
await ctx.Web.LoadAsync(
w => w.Lists.QueryProperties(
l => l.Title,
l => l.HasUniqueRoleAssignments,
l => l.RoleAssignments.QueryProperties(
ra => ra.PrincipalId,
ra => ra.RoleDefinitions.QueryProperties(
rd => rd.Id,
rd => rd.Name
)
)
));
Why requesting the roleassigments together with other properties (in this case the "Fields" property) wouldn't return items, while it would if requested alone?
NOTE: this does NOT happen if the list is requested through GetByTitle
The following WILL work:
var list = ctx.Web.Lists.GetByTitle("Documents",
l => l.Title,
l => l.Id,
l => l.HasUniqueRoleAssignments,
l => l.RoleAssignments.QueryProperties(
ra => ra.PrincipalId,
ra => ra.RoleDefinitions.QueryProperties(
rd => rd.Id
)
),
l => l.Fields.QueryProperties(
p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title
));
SDK Version:
1.4.34-nightly
The text was updated successfully, but these errors were encountered:
Thanks @pxmonti , I've managed to reproduce the error. Something goes wrong in the code that translates this to a REST query, the second top level query properties is "appended" onto the first expand... I'll work on a fix.
Thanks @jansenbe , I'll wait for a fix. If this can help, I've noticed that also other top-level properties would "break" the query, e.g. "RootFolder".
Category
Description
Calling LoadAsync for all lists of a web, will not return role assigments for any of the lists.
Steps to reproduce
await ctx.Web.LoadAsync(
w => w.Lists.QueryProperties(
l => l.Fields.QueryProperties(
p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title
),
l => l.Title,
l => l.HasUniqueRoleAssignments,
l => l.RoleAssignments.QueryProperties(
ra => ra.PrincipalId,
ra => ra.RoleDefinitions.QueryProperties(
rd => rd.Id,
rd => rd.Name
)
)
));
Expected behavior
After calling this method, for any of the returned lists/libraries the RoleAssignment property contains no records:
foreach(var reqList in ctx.Web.Lists.AsRequested())
{
foreach(var ra in reqList.RoleAssignments.AsRequested())
{
// we will never get here since RoleAssigments contains zero records
Console.WriteLine($"{ra.PrincipalId}");
}
}
Incredibly enough, this instead WILL return the role assigments (simply not querying the "Fields" property)
await ctx.Web.LoadAsync(
w => w.Lists.QueryProperties(
l => l.Title,
l => l.HasUniqueRoleAssignments,
l => l.RoleAssignments.QueryProperties(
ra => ra.PrincipalId,
ra => ra.RoleDefinitions.QueryProperties(
rd => rd.Id,
rd => rd.Name
)
)
));
Why requesting the roleassigments together with other properties (in this case the "Fields" property) wouldn't return items, while it would if requested alone?
NOTE: this does NOT happen if the list is requested through GetByTitle
The following WILL work:
var list = ctx.Web.Lists.GetByTitle("Documents",
l => l.Title,
l => l.Id,
l => l.HasUniqueRoleAssignments,
l => l.RoleAssignments.QueryProperties(
ra => ra.PrincipalId,
ra => ra.RoleDefinitions.QueryProperties(
rd => rd.Id
)
),
l => l.Fields.QueryProperties(
p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title
));
SDK Version:
1.4.34-nightly
The text was updated successfully, but these errors were encountered: