Sharepoint Permissions
3 Topics403 with a ctx.load($WEB) executeQuery
I have a powershell script which is failing with a 403 Forbidden. I have tried 2 variants of Connect-PnPOnline $SiteURL = “https://MyDomain.sharepoint.com/sites/MySPSite/” Connect-PnPOnline -Url $SiteURL -Interactive # Connect-PnPOnline -Url $SiteURL -UseWebLogin $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Web = $Ctx.Web $Ctx.Load($Web) $Ctx.Load($Web.AllProperties) $Ctx.ExecuteQuery() The ExecuteQuery returns a 403 forbidden. I am in the ‘Site Owners’ Group for https://MyDomain.sharepoint.com/sites/MySPSite I have the SharePoint Administrator role activated in Portal.Azure.Com >> Azure AD roles What am I missing ? All suggestions gratefully received. Thank youSolved1.5KViews0likes2CommentsHow to use SharePoint search query with SharePoint Granular access permissions?
I want to execute SharePoint search API with granular access for that I've changed 'Sites.ReadWrite.All' permission to 'Sites.Selected' permission, so that application would have all sites access but during search I'm getting unauthorize error ``` {"odata.error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message":{"lang":"en-US","value":"Unauthorized."}}} ``` Also tried to give sites.selected permission at tenant level, that also not works, if the only solution is to give 'Sites.ReadWrite.All' or 'Sites.Read' then there is no use of granular level access implementation Sites.Read.all will allow all sites if granted. My query is similar to below -: https://tenant.sharepoint.com/_api/search/query?querytext='*+AND+(Path:"https://tenant.sharepoint.com/sites/SITE1/RECORDS" OR Path:"https://tenant.sharepoint.com/sites/SITE2/RECORDS")'&trimDuplicates=false&selectProperties='Column1,Column2'&refiners='Column1OWSTEXT'&refinementFilters='Column1:equals(\"xxxxx\")'&rowLimit=5 Some other references regarding my question. https://sharepoint.stackexchange.com/questions/306397/how-to-use-sharepoint-search-query-with-sharepoint-granular-access-permissions?newreg=dbcbb62ae019481c9a864f537ecd0faf https://sharepoint.stackexchange.com/questions/306432/is-that-sites-selected-permissions-level-allows-the-sharepoint-online-global Really appreciate any response on this or alternative approach to to achieve this.748Views0likes0Comments