Delphi Can
WebDav ile Yandex Diskten Klasör ve Dosya Listesi Alma - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Genel Programlama (https://www.delphican.com/forumdisplay.php?fid=6)
+--- Konu Başlığı: WebDav ile Yandex Diskten Klasör ve Dosya Listesi Alma (/showthread.php?tid=4526)



WebDav ile Yandex Diskten Klasör ve Dosya Listesi Alma - theSinan - 13-02-2020

Merhaba 
Uzun Zamandır Webdav Protokolu ile Yandex'e Bağlanıp Bilgi Almaya Çalışıyordum
Nihayet Bağlantı Yapabildim Ancak Klasör Bilgilerini Veriyor Dizin adı , oluşturma ve değiştirme tarihi gibi bilgilerini listeliyor
Yandex te
https://tech.yandex.com/disk/doc/dg/reference/contains-request-docpage/
Dizin içeriğini almak için Depth Değerini 1 yazın diyor 
ben Depth: 1 yazdığım halde yine Dizin bilgisini gösteriyor


Yandex Bağlantı Kodum

		  /*
                  Edit1->Text = "https://webdav.yandex.com.tr";
                  Edit2->Text = "yandex_kullanici_ad";
                  Edit2->Text = "yandex_sifre";
                  */
                	String    Jeton;
	TStringStream *s, *r;
	UTF8String u;
	TBase64Encoding *Base64;

  try
	{
		Base64 = new TBase64Encoding(0,"");
		Jeton = Base64->Encode(Edit2->Text+":"+Edit3->Text);
		Memo1->Lines->Add("Jeton : '"+ Jeton+"'");


		u = "<D:propfind xmlnsBig Grin=\"DAV:\">\r\n"
		"<D:allprop />\r\n"
		//"<D:prop>\r\n"
			//"<D:creationdate />\r\n"
			//"<D:getlastmodified />\r\n"
			//"<D:quota-available-bytes/>\r\n"
			//"<D:quota-used-bytes/>\r\n"*/
		//"</D:prop>"
		"</D:propfind>";  //

		s = new TStringStream();
		s->WriteString(u);
		s->Seek(0, 0);
		r = new TStringStream();


	  try
	  {

		IdSSLIOHandlerSocketOpenSSL1->SSLOptions->SSLVersions << (TIdSSLVersion) ComboBox1->Text.c_str();
		IdSSLIOHandlerSocketOpenSSL1->SSLOptions->Method   << (TIdSSLVersion) ComboBox2->Text.c_str();

		IdWebDAV1->Request->UserAgent = USERAGENT;
		IdWebDAV1->Request->BasicAuthentication = true;
		IdWebDAV1->Request->Username = Edit2->Text ;
		IdWebDAV1->Request->Password = Edit3->Text ;
		IdWebDAV1->Request->Method = "PROPFIND" ;
		IdWebDAV1->Request->Accept = "*/*";
		IdWebDAV1->Request->CustomHeaders->Clear();
		IdWebDAV1->Request->CustomHeaders->Add("Content-Type: application/xml; charset=\"utf-8\"");
		IdWebDAV1->Request->CustomHeaders->Add("Host: webdav.yandex.com.tr");
		IdWebDAV1->Request->CustomHeaders->Add("Accept: */*");
		IdWebDAV1->Request->CustomHeaders->Add("Depth: 1");
		IdWebDAV1->Request->CustomHeaders->Add("Authorization: Basic "+Jeton);
		IdWebDAV1->DAVPropFind( Edit1->Text,s,r);
        Memo1->Lines->Add("---------Gelen Cevap-----------");
		Memo1->Lines->Add( r->DataString);
	  }
	  catch(Exception *HATA)
	  {
		Memo1->Lines->Add( HATA->Message);
	  }

	}
	__finally
	{
    Base64->Free();
	s->Free();
	r->Free();
	}

Nerde Hata Yapıyorum
Yardımlarınız için allah razı olsun


WebDav ile Yandex Diskten Klasör ve Dosya Listesi Alma - tavin44 - 13-02-2020

karşı tarafda linux extx ve win den bildiğin fat,ntfs gibi bildiğin bir dosya sistemi yok haliyle fiziksel olarak klasör, dizin dosya mantığıda yok.


Cvp: WebDav ile Yandex Diskten Klasör ve Dosya Listesi Alma - theSinan - 13-02-2020

(13-02-2020, Saat: 18:10)tavin44 Adlı Kullanıcıdan Alıntı: karşı tarafda linux extx ve win den bildiğin fat,ntfs gibi bildiğin bir dosya sistemi yok haliyle fiziksel olarak klasör, dizin dosya mantığıda yok.

hocam yandex disk girdiğimizde dosya ve dizinleri görebiliyoruz
bende o listeyi çekmek istiyorum

Yandex 
https://tech.yandex.com/disk/doc/dg/reference/contains-request-docpage/

burda Listeyi Gösteriyor

HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"
Content-Length: 3079

<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:">
 <d:response>
   <d:href>
     /
   </d:href>
   <d:propstat>
     <d:status>
       HTTP/1.1 200 OK
     </d:status>
     <d:prop>
       <d:creationdate>
         1970-01-01T00:00:00Z
       </d:creationdate>
       <d:displayname>
         disk
       </d:displayname>
       <d:getcontentlength>
         0
       </d:getcontentlength>
       <d:getlastmodified>
         Thu, 01 Jan 1970 00:00:00 GMT
       </d:getlastmodified>
       <d:resourcetype>
         <d:collection/>
       </d:resourcetype>
     </d:prop>
   </d:propstat>
 </d:response>
 <d:response>
   <d:href>
     /Documents/
   </d:href>
   <d:propstat>
     <d:status>
       HTTP/1.1 200 OK
     </d:status>
     <d:prop>
       <d:creationdate>
         2012-03-24T09:00:43Z
       </d:creationdate>
       <d:displayname>
         Documents
       </d:displayname>
       <d:getcontentlength>
         0
       </d:getcontentlength>
       <d:getlastmodified>
         Sat, 24 Mar 2012 09:00:43 GMT
       </d:getlastmodified>
       <d:resourcetype>
         <d:collection/>
       </d:resourcetype>
     </d:prop>
   </d:propstat>
 </d:response>
 <d:response>
   <d:href>
     /readme.pdf
   </d:href>
   <d:propstat>
     <d:status>
       HTTP/1.1 200 OK
     </d:status>
     <d:prop>
       <d:creationdate>
         2012-04-09T10:56:13Z
       </d:creationdate>
       <d:displayname>
         readme.pdf
       </d:displayname>
       <d:getcontentlength>
         455833
       </d:getcontentlength>
       <d:getcontenttype>
         application/pdf
       </d:getcontenttype>
       <d:getlastmodified>
         Mon, 09 Apr 2012 10:56:13 GMT
       </d:getlastmodified>
       <d:resourcetype/>
     </d:prop>
   </d:propstat>
 </d:response>
</d:multistatus>

ancak Ben Almaya Çalıştığımda 
Gelen Bilgi
<?xml version="1.0" encoding="UTF-8"?><d:multistatus xmlns:d="DAV:"><d:response><d:href>/</d:href><d:propstat><d:status>HTTP/1.1 200 OK</d:status><d:prop><d:creationdate>2012-04-04T20:00:00Z</d:creationdate><d:displayname>disk</d:displayname><d:getlastmodified>Wed, 04 Apr 2012 20:00:00 GMT</d:getlastmodified><d:resourcetype><d:collection/></d:resourcetype></d:prop></d:propstat></d:response></d:multistatus>
bu kadar