Forum Discussion

Amir_tounsi's avatar
Amir_tounsi
Copper Contributor
Apr 21, 2024

SharePoint ServerUnauthorizedAccessException: 'Attempted to perform an unauthorized operation.'

i cannot load Web from SPO using Context.ExecuteQueryAsync, i receive alayws the same error Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'

Property DisableCustomAppAuthentication is False I used all type of connection like token.... and with ClientId+ClientSecret. I use this Application Permission in APP: Sites.FullControl.All

using (var clientContext = new PnP.Framework.AuthenticationManager().GetACSAppOnlyContext(siteUrl, clientId, clientSecret))

{

clientContext.Load(clientContext.Web, p => p.Title);

await clientContext.ExecuteQueryAsync();

Console.WriteLine(clientContext.Web.Title);

}

No RepliesBe the first to reply

Resources