I am working on office 365 SharePoint site.
I want to fetch all lists/libraries/items where permissions are given to Everyone group across SharePoint site using CSOM.
Web web = context.Web;
var Lists = context.Web.Lists;
context.Load(Lists);
context.ExecuteQuery();
foreach (var List in Lists)
{
context.Load(List.RoleAssignments);
context.ExecuteQuery();
foreach (var RoleAssignment in List.RoleAssignments)
{
context.Load(RoleAssignment.Member);
context.ExecuteQuery();
var EveryoneexceptexternalUsers = " c:0-.f|rolemanager|spo-grid-all-users/526bf739-e2f7-4c87-a8ce-0737198cc796";
PrincipalType SharePointGroup = default(PrincipalType);
if (RoleAssignment.Member.PrincipalType == SharePointGroup && RoleAssignment.Member.LoginName == EveryoneexceptexternalUsers) {
Console.WriteLine(List.Title, "has Everyone Group");
}
else
{
Console.WriteLine("Everyone group is not present in the List");
}
Console.ReadLine();
}
}