gpt4 book ai didi

json - Microsoft.Graph 无法反序列化响应

转载 作者:行者123 更新时间:2023-12-02 23:00:29 25 4
gpt4 key购买 nike

我对编程很陌生,尤其是 Microsoft.Graph

我在处理以下问题的响应时遇到问题: https://graph.microsoft.com/v1.0/me/drive/root/children

响应看起来像这样(只是更长):

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('xyz%40hotmail.com')/drive/root/children",
"value": [
{
"createdBy": {
"user": {
"displayName": "xyz",
"id": "cf58e4781082"
}
},
"createdDateTime": "2009-01-08T08:52:07.063Z",
"cTag": "adDpFREJDR4RTQMTgxMDgyITEyOC42MzYxODM0MTU0Mjc3MDAwMDA",
"eTag": "aRURCQ0Y1OEU0A4MiExMjguMA",
"id": "EDBCF58E471082!128",
"lastModifiedBy": {
"user": {
"displayName": "xyz",
"id": "edbcf58e48082"
}
}, ............. etc...

我收到的响应是正确的,采用 JSON 格式(我相信 ><),但我无法弄清楚如何将其解析为包含文件夹名称的数组。

请帮忙!

最佳答案

已考虑使用Microsoft Graph client library ?它将反序列化 JSON。您的通话将如下所示:

// Return all children files and folders off the drive root.
var driveItems = await graphClient.Me.Drive
.Root
.Children
.Request()
.GetAsync();

foreach (var item in driveItems)
{
// Get your item information
}

这里有一些示例可以帮助您入门: https://github.com/microsoftgraph?utf8=%E2%9C%93&q=csharp

关于json - Microsoft.Graph 无法反序列化响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44745389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com