0

我是 Sharepoint 的新手,我遇到了一个问题。我正在使用 PnP/PnPjs,并且正在尝试从站点列之一中获取选择字段。我曾尝试使用 SPWeb 等,但在打字稿中存在问题。有没有办法可以导入这个或其他方式我可以获取这些数据?

4

1 回答 1

2

请参考以下代码片段:

获取选择网站栏定义:

import { sp } from "sp-pnp-js";
      let web = sp.web;
      web.fields.getByTitle("testchoice").get().then(f => {

        console.log(f);
    });

获取列表中使用的选择站点列值:

    web.lists.getByTitle("MyList").items.getById(2).get().then((item: any) => {
      console.log(item.testchoice);
  });

参考:

@pnp/sp/字段

@pnp/sp/项目

于 2019-11-22T08:28:15.880 回答