简体   繁体   English

使用 Microsoft graph API 从最近文件列表中获取文件路径

[英]Get file path from list recent files using Microsoft graph API

I'm new to Microsoft graph API where I query:我是 Microsoft graph API 的新手,我在其中查询:

GET /me/drive/recent GET /我/驱动器/最近

List recent files 列出最近的文件

But I have just one problem with the JSON response.但是JSON响应只有一个问题。 The attribute: "webDavUrl" returns an encoded string with the file path .属性: "webDavUrl"返回带有文件路径的编码字符串。

Example of the attribute "webDavUrl" with the encoded value:具有编码值的属性"webDavUrl"示例:

 "webUrl": sitename/Documents/Microsoft%20Teams%20Chat%20Files/Inla%CC%88mningsuppgift%20-%20test%20test.pdf",

Is it possible to return a file path in the list of recent files without the encoding in Microsoft graph API or do I need to decode the string myself?是否可以在 Microsoft graph API 中没有编码的情况下返回最近文件列表中的文件路径,或者我是否需要自己解码字符串?

Graph API returns only encoded url and you have to decode it by yourself.图 API 仅返回编码后的 url,您必须自己对其进行解码。

In JS it should be simple by calling decodeURI() function.在 JS 中,通过调用decodeURI() function 应该很简单。

const encodedUrl = 'sitename/Documents/Microsoft%20Teams%20Chat%20Files/Inla%CC%88mningsuppgift%20-%20test%20test.pdf';

// decode complete URL
const url = decodeURI(encodedUrl);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Facebook 页面获取最新帖子,并仅使用新的 Graph API JavaScript 显示在网站上 - Get most recent post from Facebook page, and display on website using new Graph API JavaScript only 如何使用Microsoft-Graph API中的文件名获取Excel-File ID? - How to get the Excel-File id using the filename in microsoft-graph api? 如何使用 Microsoft graph API 获取响应标头 - How to get a response headers using Microsoft graph API 如何使用 Microsoft Graph API 获取用户的照片(个人资料)? - How to get user's photo(profile) using Microsoft Graph API? 使用 JS 的 Microsoft Teams 图 API - 获取组信息 - Microsoft Teams graph API using JS - get group info 如何使用Ajax调用获取Microsoft Graph API Access令牌 - How to get Microsoft Graph API Access token using ajax call Microsoft Graph api - 将文件写入我的 oneDrive - Microsoft Graph api - write files to my oneDrive 获取扩展属性Microsoft graph JavaScript API - Get extended property Microsoft graph javascript api 从 Microsoft Graph API(测试版)通信 API 获取实时更新 - Get real time updates from Microsoft Graph API (beta) Communication API Javascript http api how to get the list of files of a directory defined by its hash using file/ls api? - Javascript http api how to get the list of files of a directory defined by its hash using file/ls api?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM