use*_*023 7 microsoft-graph-api
A@microsoft.graph.downloadUrl不适用于使用 Microsoft Graph Beta API 的聊天消息附件。
我最近在msgraph-sdk-javascript存储库中发布了一个有关通过 beta graph api 下载 Microsoft Teams 聊天消息附件的问题。
https://github.com/microsoftgraph/msgraph-sdk-javascript/issues/200
问题是目前无法获取@microsoft.graph.downloadUrl这些聊天附件。我在那里发布了一个解决方法,如下所示,但这需要额外的 api 调用,并且可能很脆弱,因为它涉及解析聊天附件的contentUrl.
function getDownloadUrl(attachment: ChatMessageAttachment, team?: Team): string {
const url = new URL(attachment.contentUrl as string);
const path = url.pathname.split('/').slice(4).join('/');
if (team) {
return `/groups/${team.id}/drive/root:/${path}`;
} else {
return `/me/drive/root:/${path}`;
}
}
Run Code Online (Sandbox Code Playgroud)
维护者要求我microsoft-graph-javascript在这里发布我的问题。
| 归档时间: |
|
| 查看次数: |
1035 次 |
| 最近记录: |