[英]WebDAV get free space info
I'm working with Yandex Disk API ( http://api.yandex.com/disk/doc/dg/reference/propfind_space-request.xml ). 我正在使用Yandex Disk API( http://api.yandex.com/disk/doc/dg/reference/propfind_space-request.xml )。 Having trouble with adding property in the request body ( quota-available-bytes and quota-used-bytes ) 在请求正文中添加属性时遇到问题( quota-available-bytes和quota-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;
}
}
I don't get any response, maybe i can use another method? 我没有得到任何回应,也许我可以使用另一种方法? What should i do? 我该怎么办? Thanks! 谢谢!
quota-available-bytes应使用相同的命名空间“D”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.