Listing Directory Content
Internal WebDAV
List the content of a directory on the portal.
Object URI
|
{INT_WEBDAV_URL}/Dir_path
|
HTTP Method
|
GET
|
Request Header
|
Empty
|
Request Body
|
Empty
|
Response Body
|
The content in XML format. Each entry marked as <d:response> describes either a folder of a file. Under each entry, the <d:prop> tags include the folder's or file's path, content length in bits, creation date, and modification date.
|
Expected Response status
|
207 Multi-Status
If a response such as 404 Not Found is returned, check the spelling of the file in the URL.
If a response such as 403 Not Allowed is returned, the file is passphrase protected.
|
For example, the XML below is an example of returned content.
<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
<d:response>
<d:href>/ServicesPortal/webdav/myfiles/branding/</d:href>
<d:propstat>
<d:prop>
<d:getcontenttype>application/octet-stream</d:getcontenttype>
<d:getcontentlength>0</d:getcontentlength>
<d:resourcetype>
<d:collection />
</d:resourcetype>
<d:getlastmodified>Tue, 23 Dec 2014 15:23:44 GMT</d:getlastmodified>
<d:displayname>branding</d:displayname>
<d:getetag>2014-12-23 15:23:44.0_2009016650</d:getetag>
<d:creationdate>2014-12-23T15:23:44Z</d:creationdate>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/ServicesPortal/webdav/myfiles/branding/AAA/</d:href>
<d:propstat>
<d:prop>
<d:getcontenttype>application/octet-stream</d:getcontenttype>
<d:getcontentlength>0</d:getcontentlength>
<d:resourcetype>
<d:collection />
</d:resourcetype>
<d:getlastmodified>Tue, 16 Dec 2014 13:46:58 GMT</d:getlastmodified>
<d:displayname>AAA</d:displayname>
<d:getetag>2014-12-16 13:46:58.0_1398410522</d:getetag>
<d:creationdate>2014-12-16T13:46:58Z</d:creationdate>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/ServicesPortal/webdav/myfiles/branding/AAA/CTERA_Mobile_4.6.13.apk</d:href>
<d:propstat>
<d:prop>
<d:getcontenttype>application/octet-stream</d:getcontenttype>
<d:getcontentlength>29396755</d:getcontentlength>
<d:resourcetype />
<d:getlastmodified>Tue, 02 Dec 2014 16:31:56 GMT</d:getlastmodified>
<d:displayname>CTERA_Mobile_4.6.13.apk</d:displayname>
<d:getetag>2014-12-02 16:31:56.0_198708522</d:getetag>
<d:creationdate>2014-12-02T16:31:56Z</d:creationdate>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/ServicesPortal/webdav/myfiles/branding/ctera%20mobile%20branding%20kit.rar</d:href>
<d:propstat>
<d:prop>
<d:getcontenttype>application/octet-stream</d:getcontenttype>
<d:getcontentlength>2474690</d:getcontentlength>
<d:resourcetype />
<d:getlastmodified>Sun, 05 Oct 2014 11:32:12 GMT</d:getlastmodified>
<d:displayname>ctera mobile branding kit.rar</d:displayname>
<d:getetag>2014-10-05 12:32:12.0_-535508184</d:getetag>
<d:creationdate>2014-10-05T11:32:12Z</d:creationdate>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
</d:multistatus>
External WebDAV
Java Example
To list the content of a certain folder, for example myfiles, use:
List <DavResource> resources = sardine.list({EXT_WEBDAV_URL} + "myfiles");
for (DavResource davResource: resources) {
System.out.println(davResource);
}