跳过并获取参数以使用rest api从flist中检索项目

时间:2017-01-24 14:37:19

标签: sharepoint sharepoint-list

我需要跳过n项并接下来的n项。 这是我的休息api用来做这个。我搜索并添加了这些参数来请求它不起作用。回应是;

GET https://mydomain.sharepoint.com/sites/test14jan/_api/web/lists/getbytitle('announcement2')/items?$select=Title,Id$skip=0&$top=10 400 (Bad Request)

这是我的休息api;

private readItems(skip, take): void {

this.props.httpClient.get(`${this.siteUrl}/_api/web/lists/getbytitle('${this.props.listName}')/items?$select=Title,Id$skip=${skip}&$top=${take}`, 
    SPHttpClient.configurations.v1)
      .then((response: Response): Promise<{ value: IAnnouncement[] }> => {
        return response.json();
      })
      .then((response: { value: IAnnouncement[] }): void => {
        this.setState({
          status: `Successfully loaded ${response.value.length} items`,
          items: response.value
        });
      }, (error: any): void => {
        this.setState({
          status: 'Loading all items failed with error: ' + error,
          items: []
        });
      });
  }

我该如何解决?

0 个答案:

没有答案