0

I would like to check if "all authenticated users" has read permissions on a site collection. If it is not existed I would like to add the permissions. How to do that?

I tried this but it is not working:

SPUser allusers = site.OpenWeb().EnsureUser("NT AUTHORITY\\authenticated users");

            if (site.OpenWeb().DoesUserHavePermissions(SPBasePermissions.EnumeratePermissions))
            {
                if (!site.OpenWeb().DoesUserHavePermissions(allusers.LoginName, SPBasePermissions.Open))
                {
                    //do something
                    site.OpenWeb().SiteUsers.Add("NT AUTHORITY\\authenticated users", string.Empty, string.Empty, string.Empty);
                }
            }
  • Which user you are asking about is that about a current logged in user??? – Niranjan Kulkarni Jul 3 '15 at 12:43
  • If you want to give read access to the users then add them to the visitors group of the sharepoint site. – Niranjan Kulkarni Jul 3 '15 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.