【问题标题】:WebDAV get free space infoWebDAV 获取可用空间信息
【发布时间】:2013-09-09 19:38:07
【问题描述】:

我正在使用 Yandex 磁盘 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;
    }
}

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

【问题讨论】:

    标签: c# httpwebrequest webdav yandex-api


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-29
      • 2019-09-30
      • 2019-02-08
      • 1970-01-01
      • 2013-04-21
      相关资源
      最近更新 更多