以下代码抛出错误,Web服务调用似乎没有返回json ....
private _url =“https://us.sharepoint.com/sites/poc/_api/web/lists/getbytitle('”+“Micro”+“')/ items”;
constructor(private http: Http) { }
getCMPosts() {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Accept', 'application/json;odata=verbose');
this._url = "https://us.sharepoint.com/sites/poc/_api/web/lists/getbytitle('" + "Micro" + "')/items";
console.log("URL 1: " + "https://us.sharepoint.com/sites/poc/_api/web/lists/getbytitle('" + "Micro" + "')/items");
return this.http.get("https://us.sharepoint.com/sites/poc/_api/web/lists/getbytitle('" + "Micro" + "')/items", headers)
.map(this.extractData)
}
private extractData(res: Response) {
console.log("URL 2: " + "https://us.sharepoint.com/sites/poc/_api/web/lists/getbytitle('" + "Micro" + "')/items")
console.log("Response Status: " + res.status);
console.log("res.headers: " + res.headers);
console.log("Response Text: " + res.text);
console.log("Response To String: " + res.toString());
let body = res.json();
return body.data || {};
}
图像错误请检查 Error Screen Shot