Forum Discussion

Hari Murugesan's avatar
Hari Murugesan
Copper Contributor
Mar 15, 2018

Issues getting SharePoint List Image to my Mobile Image Preview

I am facing issues getting the SharePoint list image to my Mobile App on Image Preview.
When I pass the Image URL as in the code below, I am getting a 401 error.
I would appreciate, if anybody could suggest a solution for this issue.

Image Url = "Tenant name/NewsImagesHF/allergens-banner_0.jpg";
 
                  async getImageUrl(url: any) {
                            let options = this._apiHeader();
                           this._apiGetData(url, options);     }
 
                  async _apiGetData(apiURI: any, options: any) {
                                  return new Promise((resolve, reject) => {
                                 this._http.get(apiURI, options)
                                .subscribe(res => {
                                resolve(res.json());
                                console.log(res.json());
                                console.log(res);
                        }, (err) => {
                         reject(err); }); }); }
 
                 _apiHeader() {
                          let headers = new Headers();
                         headers.append('Authorization', 'Bearer ' + localStorage.getItem("token"));
                         headers.append('Content-Type', 'application/json');
                        let options = new RequestOptions({ headers: headers });
                       return options;  }
No RepliesBe the first to reply

Resources