Angular 如何设置图形请求标头以纯文本形式返回Outlook任务正文

Angular 如何设置图形请求标头以纯文本形式返回Outlook任务正文,angular,microsoft-graph-api,microsoft-graph-sdks,Angular,Microsoft Graph Api,Microsoft Graph Sdks,我正试图从/beta/me/outlook/tasks获取响应,以返回原始文本(“body”:{“contentType”:“text”,}),但我总是以html格式接收它 async getTaskList():Promise{ 试一试{ 让结果=等待此。graphClient .api('https://graph.microsoft.com/beta/me/outlook/tasks') .header(“首选”,“内容类型:'text')) //.header('preference',

我正试图从
/beta/me/outlook/tasks
获取响应,以返回原始
文本
“body”:{“contentType”:“text”,}
),但我总是以
html
格式接收它

async getTaskList():Promise{
试一试{
让结果=等待此。graphClient
.api('https://graph.microsoft.com/beta/me/outlook/tasks')
.header(“首选”,“内容类型:'text'))
//.header('preference','contentType=“text”'))
.header('preference','outlook.timezone=“中欧标准时间”)
.header('IdType','ImmutableId')
.select('id,owner,startDateTime,dueDateTime,subject,body'))
.filter(“状态ne‘已完成’并开始使用(主题为‘Schválit home office’)”)
.get();
返回result.value;
}捕获(错误){
this.alertsService.add('notgettaskslist',JSON.stringify(error,null,2));
}
}
预期结果:

"body": {
      "contentType": "text",
      "content": "Lorem ipsum ..."
    },
实际结果:

"body": {
      "contentType": "html",
      "content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta name=\"Generator\" content=\"Microsoft Exchange Server\">\r\n<!-- converted from rtf -->\r\n<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>\r\n</head>\r\n<body>\r\n<font face=\"Calibri\" size=\"2\"><span style=\"font-size:11pt;\">\r\n<div>Lorem ipsum ...</div>\r\n<div>&nbsp;</div>\r\n</span></font>\r\n</body>\r\n</html>\r\n"
    },
“正文”:{
“内容类型”:“html”,
“内容”:“\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nREM ipsum…\r\n\r\n\r\n\r\n\r\n”
},

对于Outlook/Exchange终结点,
首选
标题的正确语法是
Outlook.body content type=“text”

.header(“首选”、“utlook.body内容类型='text'))
也就是说,
/outlook/tasks
只支持请求首选时区,而不支持请求内容类型。因此,您现在需要在您的终端上进行HTML到文本的转换


考虑到它仍处于beta/预览阶段,在发布之前可能会发生变化。文档页面底部有一个反馈部分,您可以在其中询问他们添加此内容的计划(或缺乏计划)。

contentType是您发送的内容,responseType是您收到的内容。我认为您需要设置“接受”http headerresponseType:“文本”