[英]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 /我/驱动器/最近
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.