【发布时间】:2019-03-27 20:43:33
【问题描述】:
试图通过 SPFx webpart 项目中 spHttpClient 对象的 get 方法检索列表项。
这里是代码片段;
private readItems(): void {
this.setState({
status: 'Loading all items...',
items: []
});
this.props.httpClient.get(`${this.siteUrl}/_api/web/lists/getbytitle('${this.props.listName}')/items?$select=Title,Id`,
SPHttpClientConfigurations.v1)
.then((response: Response): Promise<{ value: IListItem[] }> => {
debugger;
return response.json();
});
}
消息很明显,但我确实需要获取此网址中的列表项。我怎样才能实现它?
我用 yeoman generator("yo @microsoft/sharepoint") 创建了这个项目,有什么配置可以让它运行 http:// 而不是 https://
如您所知,应用程序的默认地址是“https://localhost:4321/temp/workbench.html”
【问题讨论】:
标签: sharepoint