Fixed to look for SharePoint's access denied page in the response and throw an appropriate error if found. (#493)

This commit is contained in:
Jeff Burt 2018-04-27 10:27:50 -05:00 committed by Vesa Juvonen
parent cfa111bbad
commit 719171081f
1 changed files with 7 additions and 1 deletions

View File

@ -134,7 +134,13 @@ export class ContentQueryService implements IContentQueryService {
return new Promise<string>((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);