C# 有效负载中的属性文件夹具有与架构图Api不匹配的值

C# 有效负载中的属性文件夹具有与架构图Api不匹配的值,c#,json,microsoft-graph-api,C#,Json,Microsoft Graph Api,在一个驱动器中创建文件夹的graph API请求为 POST /me/drive/root/children Content-Type: application/json { "name": "New Folder", "folder": { }, "@microsoft.graph.conflictBehavior": "rename" } 但我不理解如何在httprequest内容体中传递“{}” 我的代码: var tt

在一个驱动器中创建文件夹的graph API请求为

   POST /me/drive/root/children
   Content-Type: application/json

    {
      "name": "New Folder",
      "folder": { },
      "@microsoft.graph.conflictBehavior": "rename"
    }
但我不理解如何在httprequest内容体中传递“{}”

我的代码:

 var tt = "{ }";
var jsonData = $@"{{ ""name"": ""{txtValue}"",""folder"":""{tt}""}}";
var body = new StringContent(jsonData, Encoding.UTF8, 
"application/json"); 
apiRequest.Content = body;
apiRequest.Headers.Accept.Add(new 
MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await httpClient.SendAsync(apiRequest);
string d = response.Content.ReadAsStringAsync().Result.ToString();
但给出错误“代码”:“BadRequest”,“message”:“有效负载中的属性文件夹具有与架构不匹配的值。”


谁能帮我一把吗

有没有什么特别的理由不利用这个问题

无论如何,下面的示例演示了如何通过
HttpClient

using (var client = new HttpClient())
{
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
    client.BaseAddress = new Uri("https://graph.microsoft.com");

    var folderPayload = new Dictionary<string, object>
    {
       ["name"] = "Test Folder",
       ["folder"] = new { },
       ["@microsoft.graph.conflictBehavior"] = "rename"
    };

   var requestContent = new StringContent(JsonConvert.SerializeObject(folderPayload));
   requestContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
   var response = await client.PostAsync($"/v1.0/me/drive/root/children", requestContent);
   var data = response.Content.ReadAsStringAsync().Result.ToString();
}
使用(var-client=new-HttpClient())
{
client.DefaultRequestHeaders.Authorization=新的AuthenticationHeaderValue(“承载者”,accessToken);
client.BaseAddress=新Uri(“https://graph.microsoft.com");
var folderPayload=新字典
{
[“名称”]=“测试文件夹”,
[“文件夹”]=new{},
[“@microsoft.graph.conflictBehavior”]=“重命名”
};
var requestContent=newstringcontent(JsonConvert.SerializeObject(folderPayload));
requestContent.Headers.ContentType=MediaTypeHeaderValue.Parse(“应用程序/json”);
var response=wait client.PostAsync($“/v1.0/me/drive/root/children”,requestContent);
var data=response.Content.ReadAsStringAsync().Result.ToString();
}

我只是在试验。非常感谢,伙计。