英文:
Graph Api File Upload to Sharepoint Library Json Format Error
问题
我试图从Power Apps使用此教程将一个简单的txt文档上传到SharePoint库。
我认为我操作正确,经过了很多权限问题的故障排除过程,但我卡在了这个错误上:
无法读取JSON请求负载。
我只是使用以下方式发送了一个PUT请求:
Office365Groups.HttpRequest(
"https://graph.microsoft.com/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content:",
"PUT",
ThisRecord.Value
)
mySiteId
和 myDriveId
都是正确的。ThisRecord.Value
是附件字段中的文件内容。
如果我在Graph Explorer上尝试这个操作,我也会得到相同的结果。
在文档中明确说明负载应为text/plain。
- 如果文档要求text/plain负载,为什么要求JSON内容类型?
- 有关如何继续前进的任何线索吗?
英文:
I'm trying to upload a simple txt document to a sharepoint library, from power apps, using this tutorial.
I think I'm doing it right, troubleshooted a lot of permissions issues trough the process, but I got stuck in this error:
Unabel to read JSON request payload.
I'm just sending a put request using this:
Office365Groups.HttpRequest(
"https://graph.microsoft.com/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content:",
"PUT",
ThisRecord.Value
)
mySiteIdid
and myDriveId
, I got them both correct. ThisRecord.Value
is the file content from the attachment field.
I also get the same result if I try this on the Graph Explorer.
It clearly states in the documentation, that the payload should be text/plain.
- Why would it ask for a json content-type if the documentation states
for a text/plain payload? - Any clues on how to move forward?
答案1
得分: 1
It works fine if you remove :
of the URL
/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content:
/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content
I would also set the Content-Type
parameter to text/plain
Office365Groups.HttpRequest(
"https://graph.microsoft.com/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content",
"PUT",
ThisRecord.Value,
"text/plain"
)
Office 365 group - send HTTP request
英文:
It works fine if you remove :
of the url
/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content:
/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content
I would also set the Content-Type
parameter to text/plain
Office365Groups.HttpRequest(
"https://graph.microsoft.com/v1.0/sites/{mySiteId}/drives/{myDriveId}/root:/file.txt:/content",
"PUT",
ThisRecord.Value,
"text/plain"
)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论