From 719171081f9334eccf6568e3bf1dfd36ec45355a Mon Sep 17 00:00:00 2001 From: Jeff Burt Date: Fri, 27 Apr 2018 10:27:50 -0500 Subject: [PATCH] Fixed to look for SharePoint's access denied page in the response and throw an appropriate error if found. (#493) --- .../src/common/services/ContentQueryService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/react-content-query-webpart/src/common/services/ContentQueryService.ts b/samples/react-content-query-webpart/src/common/services/ContentQueryService.ts index e1ff0097f..c3713ee38 100644 --- a/samples/react-content-query-webpart/src/common/services/ContentQueryService.ts +++ b/samples/react-content-query-webpart/src/common/services/ContentQueryService.ts @@ -134,7 +134,13 @@ export class ContentQueryService implements IContentQueryService { return new Promise((resolve,reject) => { this.spHttpClient.get(fileUrl, SPHttpClient.configurations.v1).then((response: SPHttpClientResponse) => { if(response.ok) { - resolve(response.text()); + if(response.url.indexOf('AccessDenied.aspx') > -1){ + reject('Access Denied'); + } + else + { + resolve(response.text()); + } } else { reject(response.statusText);