koltyakov / sp-rest-proxy

🌐 SharePoint API Proxy for local development
MIT License
172 stars 43 forks source link

Access Denied when accessing bulk data or multiple calls #81

Closed siva111 closed 3 years ago

siva111 commented 5 years ago

Hi @AndrewKoltyakov , I am using SP Rest Proxy as module in an angular 6 CLI SPA with SharePoint Online. Things are working fine when there is 1 or 2 rest calls to SPO site. But getting Access Denied error when trying to get data from more than 2 lists or get all data items from a list ( >5000 items) using getPaged method. Following is the code i used for getting all items from list. First call works fine and in getpagedData method it fails with Access Denied.

getData(options: PnpOptions) { let data = from(sp.web.lists.getByTitle(options.ListName).items .filter(options.Filter).select(options.Select) .orderBy(options.OrderBy) .top(options.Top) .get()); return data; } getpagedData(result: any, resultArray: any[]) { if (result.hasNext) { from(result.getNext()).subscribe((data) => { data.results.map(item => { resultArray.push(item) }); this.getpagedData(data, resultArray) }); } }

In terms of accessing multiple lists data it fails in a random manner sometimes second call or sometimes third call.

Any clue on this.

Thanks in Advance.

koltyakov commented 5 years ago

Can you check in network tools if there are requests to non-localhost (proxy's endpoint) but actual SharePoint URLs? Get all/paged helpers use pagination tokens and URIs from API responses to construct next request. I probably not replacing these URIs. Will take a look. It is definitely something which can be amended.

koltyakov commented 5 years ago

Just checked. getAll, getPaged, getNext helpers work just fine with proxy.

image

image

siva111 commented 5 years ago

Hi @koltyakov , Not sure why am still getting this issue. I will try in another tenant and will update you shortly. Thanks for the prompt responses.