通过Send Message端点将图像作为托管内容上传的新方法很棒!但是,是否有一种方法可以将文本/纯文本作为托管内容上传,以便在邮件中发布代码段卡? 我曾尝试上传文本,但响应给我一个错误,提示仅允许的内容类型是“图像/ jpg,图像/ jpeg,图像/ png”。
示例请求:
{
"body": {
"contentType": "html",
"content": "<attachment id=\"4d92eb51ab9c48ebb5b364794a2fa569\"></attachment>"
},
"attachments": [
{
"id": "4d92eb51ab9c48ebb5b364794a2fa569",
"contentType": "application/vnd.microsoft.card.codesnippet",
"contentUrl": null,
"content": "{\"name\":\"\",\"language\":\"CSharp\",\"lines\":1,\"wrap\":false,\"codeSnippetUrl\":\"../hostedContents/1/$value\"}",
"name": null,
"thumbnailUrl": null
}
],
"hostedContents":[
{
"@microsoft.graph.temporaryId": "1",
"contentBytes": "VGVzdA==",
"contentType": "text/plain"
}
]
}
响应:
{
"error": {
"code": "BadRequest",
"message": "Unsupported content type in hostedContent with Id '1'. Allowed values are 'image/jpg,image/jpeg,image/png'",
"innerError": {
"date": "2020-10-07T12:17:15",
"request-id": "ed24f5df-3e1f-4871-b430-e4c1c9f30348",
"client-request-id": "ed24f5df-3e1f-4871-b430-e4c1c9f30348"
}
}
}
答案 0 :(得分:1)
我在GitHub文档中收到了一个答案:https://github.com/microsoftgraph/microsoft-graph-docs/issues/10210#issuecomment-705050649
目前不支持代码片段。他们在要支持的事情清单上,但没有时间表可共享。