【发布时间】:2022-10-20 01:25:20
【问题描述】:
我需要连接到 web excel 中的共享点列表以进行读写,本质上使用 excel 就像我可以构建更智能计算的表单一样(是的,我知道 powerapps/automate 是一个更好的解决方案,但是公司对此有一些限制正面)。到目前为止,我的脚本如下所示:
let bob = await getListData();
let mySheet = workbook.getActiveWorksheet();
let myCell = mySheet.getCell(1,1)
myCell.setValue(bob)
}
async function getListData(){
let dataj='test';
let headers:{};
headers ={
"method":"GET",
"credentials": "same-origin",
"headers": {
"accept": "application/json;odata=verbose",
"accept-language": "en-US,en;q=0.9",
"content-type": "application/json;odata=verbose"}
}
await fetch("https://mySite.sharepoint.com/sites/myGroup/_api/web/lists/GetByTitle('myList')/items", headers)
.then((data) => {dataj=data.statusText; console.log(dataj)});
return dataj
}
我已经在浏览器控制台中测试了第二个功能,我得到了预期的响应,但是在 officescript 中我得到“禁止”,而如果我将凭据更改为“包含”,我得到“获取失败”。有人有想法吗?
【问题讨论】:
-
您是否尝试过将 PowerAutomate 与 SharePoint 连接器一起使用?你可能会更轻松。
-
遗憾的是,我的组织不允许中央团队以外的任何人共享 PowerAutomate,因此虽然这对我来说更容易,但其他人无法使用该流程。
-
您是否考虑过使用 Logic Apps 而不是 Power Automate?
-
不,但是 azure 比 powerapps 锁定得更紧...
标签: excel rest sharepoint office-scripts