gpt4 book ai didi

c# - WebDAV 获取空闲空间信息

转载 作者:行者123 更新时间:2023-11-30 15:32:36 26 4
gpt4 key购买 nike

我正在使用 Yandex Disk API ( http://api.yandex.com/disk/doc/dg/reference/propfind_space-request.xml )。在请求正文中添加属性时遇到问题(quota-available-bytesquota-used-bytes)

public static string SpaceInfo(string path)
{
// Authorization.
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("https://webdav.yandex.ru/");
webReq.Accept = "*/*";
webReq.Headers.Add("Depth: 0");
webReq.Headers.Add("Authorization: OAuth " + token);
webReq.Method = "PROPFIND";

// Adding data in body request.
string inputData = @"<D:propfind xmlns:D=""DAV:""><D:prop><quota-available-bytes/></D:prop></D:propfind>";
byte[] buffer = new ASCIIEncoding().GetBytes(inputData);

webReq.ContentType = "text/xml; encoding='utf-8";
webReq.ContentLength = buffer.Length;

try
{
HttpWebResponse resp = (HttpWebResponse)webReq.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string dinfo = sr.ReadToEnd();

return dinfo;
}
}

我没有收到任何回复,也许我可以使用其他方法?我应该怎么办?谢谢!

最佳答案

quota-available-bytes 应该使用相同的命名空间“D”

关于c# - WebDAV 获取空闲空间信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18705670/

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