0

I am attempting to connect to SharePoint 2016 Server (On Premise) using CSOM. I've researched a number of items and have found no solution. Here's the code I'm using:

clientCtx.AuthenticationMode = ClientAuthenticationMode.Default;
            clientCtx.Credentials = new NetworkCredential("userName","password");            
            //Get the Web
            var cliWeb = clientCtx.Web;
            //Get all of the lists
            var allLists = cliWeb.Lists;
            //Now package the query
            clientCtx.Load(allLists);
            //Now execute the query
            try
            {
                clientCtx.ExecuteQuery();
            }

I can see from the ULS log the auth-N works as expected but that the account does not have any permissions. I'm signed in with a Site Collection admin account

Successfully got user key for user. UserNameSuffix: '0#.w|XXXXXXXXX'. a9d0fc9e-de99-707e-8b46-5c178ad55341 08/22/2019 14:46:31.15 w3wp.exe (0x4584) 0x1C94 SharePoint Foundation Logging Correlation Data xmnv Medium Site=/ a9d0fc9e-de99-707e-8b46-5c178ad55341 08/22/2019 14:46:31.16 w3wp.exe (0x4584) 0x1C94 SharePoint Foundation General 8xfr Medium PermissionMask check failed for {75A3160C-BF3B-4D51-AAEF-2AC9D7437BC0}. Asking for 0x08000000, have 0x00000000 a9d0fc9e-de99-707e-8b46-5c178ad55341 08/22/2019 14:46:31.16 w3wp.exe (0x4584) 0x1C94 SharePoint Foundation Site Cache az4z8 Medium Looking up SPSite by ID 2b98c19f-32f4-4498-a61c-bc8f6735119a in memory. a9d0fc9e-de99-707e-8b46-5c178ad55341 08/22/2019 14:46:31.16 w3wp.exe (0x4584) 0x1C94 SharePoint Foundation General 8xfr Medium PermissionMask check failed for {75A3160C-BF3B-4D51-AAEF-2AC9D7437BC0}. Asking for 0x00010000, have 0x00000000 a9d0fc9e-de99-707e-8b46-5c178ad55341

Any insight as to what I'm missing would be greatly appreciated.

2
  • Is the error message still the same if you change your code a) use domain in credentials (new NetworkCredential(domain\UserName, password); b) load Web and not AllLists ? (Web web = clientctx.Web; clientctx.Load(web);) – Celophysis Aug 23 '19 at 13:25
  • Thank you Celophysis, I did try the configuration using the syntax for the NetworkCredential constructor with domain\user, password. I also tried the constructor "user","password","domain" and all resulted in a 401 error. I did attempt to load just the web as you suggested and it also generates a 401 error. I suspect there is a configuration on the SharePoint server that I'm missing since the account is not getting anything assigned to the permission mask. – RQHansen Aug 23 '19 at 13:56
0

I've corrected the issue, the DNS was routing to the wrong site so the accounts did not have permission. Once that issue was corrected the code above worked as expected.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.