Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions src/Commands/Principals/GetUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,28 @@ protected override void ExecuteCmdlet()
foreach (var listItem in item)
{
LogDebug(string.Format("Enumerating though listitems"));
listItem.EnsureProperty(i => i.HasUniqueRoleAssignments);

if (listItem.HasUniqueRoleAssignments)
try
{
string listItemUrl = listItem["FileRef"].ToString();
LogDebug(string.Format("List item {0} HasUniqueRoleAssignments", listItemUrl));

CurrentWeb.Context.Load(listItem.RoleAssignments, r => r.Include(
ra => ra.RoleDefinitionBindings,
ra => ra.Member.LoginName,
ra => ra.Member.Title,
ra => ra.Member.PrincipalType));
CurrentWeb.Context.ExecuteQueryRetry();

users.AddRange(GetPermissions(listItem.RoleAssignments, listItemUrl));
listItem.EnsureProperty(i => i.HasUniqueRoleAssignments);

if (listItem.HasUniqueRoleAssignments)
{
string listItemUrl = listItem["FileRef"].ToString();
LogDebug(string.Format("List item {0} HasUniqueRoleAssignments", listItemUrl));

CurrentWeb.Context.Load(listItem.RoleAssignments, r => r.Include(
ra => ra.RoleDefinitionBindings,
ra => ra.Member.LoginName,
ra => ra.Member.Title,
ra => ra.Member.PrincipalType));
CurrentWeb.Context.ExecuteQueryRetry();

users.AddRange(GetPermissions(listItem.RoleAssignments, listItemUrl));
}
}
catch (Exception ex)
{
LogWarning(string.Format("Error while enumerating listitem {0} in list {1} in site {2} with error {3}", listItem.Id, list.RootFolder.ServerRelativeUrl, CurrentWeb.Url, ex.Message));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reshmee011 - any thoughts on this ? Seems like a valid comment, though am not sure if it might be a breaking change or something ?

}
}
}
Expand Down
Loading