microsoft-graph-api - 从图形 api 创建一个 SPO 经典新闻页面
问题描述
我正在尝试从图形 api 创建一个新闻页面(首先使用资源管理器,然后以编程方式),但我遇到了一些问题。
首先,我的新闻页面包含在此 url 的“页面”列表中:/sites/myedition-edition/en-us/news/Pages/Forms/AllItems.aspx 但在尝试访问https://graph.microsoft.com/时beta/sites/[mysite-id]/pages,我收到一个未找到项目的回复。
所以我尝试将页面作为列表项上传,并遵循文档: POST https://graph.microsoft.com/beta/sites/[mysite-id]/lists/[mylist-id]/items,但后来我收到错误消息“文件和文件夹只能通过 OneDrive API 添加到 DocumentLibrary”
所以最后我尝试在相关驱动器中上传文件: https ://graph.microsoft.com/beta/sites/[mysite-id]/drives/[mydrive-id]/root:/Test1.aspx:/content 具有以下 json 正文:
{
"name": "Test1.aspx",
"title": "Test1",
"contentType": { //custom content type
"id": "some id",
},
"fields": {
"Title": "Test",
"Comments": "Reference",
"ArticleStartDate": "02-05-2021 22:00",
"NewsURL": "https://myurl.aspx",
"PublishingStartDate": "02-05-2021 22:00",
"ModifiedEditable": "04-05-2021 17:37",
"ArticleByLine": "Lorem Ipsum",
"PublishingPageImage": "https://myurl.aspx",
}
}
然后我可以看到我的库中的文件未发布,没有设置任何属性,json 直接作为文件中的内容。要使用的正确 json 结构是什么?如何将 t 与正确的自定义内容类型相关联?上传后可以直接发布文件吗?我缺少任何步骤吗?谢谢
解决方案
推荐阅读
- youtube-dl - 当我尝试从 Udemy 下载此课程时,为什么会出现此错误:无法下载网页,HTTP 错误 403?
- angular - 运行 ng test 时缺少声明文件
- java - 我正在以反向或自然顺序对 java 中的日期列表进行排序,但它按年份分组
- c# - 为什么 console.writeline 在 Visual Studio for Mac 中不起作用?
- neural-network - 使用神经网络进行投资组合选择
- c# - C# 应用程序在 InitializeComponent() 启动时崩溃,抛出 CultureNotFoundException
- c++ - 将指针作为函数参数传递
- delphi - 如何在 Delphi 应用程序中检测 TPopupMenu 的 OnClose (OnPopDown) 事件
- laravel - 如何使用 laravel 在 Outlook 上创建日历事件?
- c++ - C/C++ 中的指针实际上是如何存储地址的?