New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using PROPFIND with custom properties (owncloud / nextcloud) #30
Comments
Hi @Bogeyx, Could you share an example of an XML response that you're getting from the server, please? |
Thx for the fast Answer. Doing a manual propfind with depth 1 returns: <?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<d:response>
<d:href>/remote.php/webdav/</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Fri, 10 Aug 2018 11:06:30 GMT</d:getlastmodified>
<oc:fileid>7</oc:fileid>
<oc:size>2124220271</oc:size>
<nc:mount-type></nc:mount-type>
<oc:owner-display-name>Max</oc:owner-display-name>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/remote.php/webdav/Verwaltung/</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Wed, 08 Aug 2018 18:13:03 GMT</d:getlastmodified>
<oc:fileid>383</oc:fileid>
<oc:size>67701476</oc:size>
<nc:mount-type>group</nc:mount-type>
<oc:owner-display-name>Max</oc:owner-display-name>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/remote.php/webdav/Verbreitung_Fragebogen.docx</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Wed, 06 Jun 2018 20:30:01 GMT</d:getlastmodified>
<oc:fileid>1633</oc:fileid>
<oc:size>10993</oc:size>
<nc:mount-type>shared</nc:mount-type>
<oc:owner-display-name>julian</oc:owner-display-name>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
</d:multistatus> |
The response can be parsed correctly, seems like a problem in a request that is made by the lib. Can you send me an example of a request that you're sending via curl? Does it work if you specify only a single namespace? var param = new PropfindParameters
{
Namespaces = new List<NamespaceAttr> {
new NamespaceAttr("http://owncloud.org/ns")
}.
CustomProperties = new List<XName> { "fileid", "size", "owner-display-name" },
ApplyTo = ApplyTo.Propfind.ResourceAndAncestors
} |
Sorry, I got confused by LINQ to XML. Instead of a namespace name ( Your example generates the following request: <?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:allprop />
<D:include xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<fileid xmlns="oc" />
<size xmlns="oc" />
<owner-display-name xmlns="oc" />
<mount-type xmlns="nc" />
</D:include>
</D:propfind> If you use the following parameters new PropfindParameters
{
Namespaces = new List<NamespaceAttr>
{
new NamespaceAttr("oc", "http://owncloud.org/ns"),
new NamespaceAttr("nc", "http://nextcloud.org/ns")
},
CustomProperties = new List<XName>()
{
XName.Get("fileid", "http://owncloud.org/ns"),
XName.Get("size", "http://owncloud.org/ns"),
XName.Get("owner-display-name", "http://owncloud.org/ns"),
XName.Get("mount-type", "http://nextcloud.org/ns"),
},
ApplyTo = ApplyTo.Propfind.ResourceAndAncestors
} it generates this: <?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:allprop />
<D:include xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<oc:fileid />
<oc:size />
<oc:owner-display-name />
<nc:mount-type />
</D:include>
</D:propfind> I hope this request will be handled correctly by your WebDAV server. Please let me know if it works. |
OK, so you WebDAV server doesn't support |
Hi @Bogeyx, I have published a release 2.2.3 that adds an ability to change an issued PROPFIND request to use 'd:prop' instead of 'allprop' and 'include'. To achieve that you need to pass var @params = new PropfindParameters
{
RequestType = PropfindRequestType.NamedProperties,
CustomProperties = new XName[] {
"{DAV:}getlastmodified",
"{http://owncloud.org/ns}fileid",
"{http://owncloud.org/ns}permissions",
"{http://owncloud.org/ns}size",
"{http://owncloud.org/ns}owner-display-name",
"{http://nextcloud.org/ns}mount-type"
},
Namespaces = new[] {
new NamespaceAttr("oc", "http://owncloud.org/ns"),
new NamespaceAttr("nc", "http://nextcloud.org/ns")
}
} You can also refer to this test https://github.com/skazantsev/WebDavClient/blob/master/src/WebDav.Client.Tests/Methods/PropfindTests.cs#L269-L304 It should help integrate with WebDAV servers that don't support 'allprop' or 'include'. |
Hi, |
Hi @skazantsev |
Hey,
i couldn't find a documentation so: Am i doing something wrong or is there a bug?
Im trying to connect to my nextcloud webdav and get some Proeprties:
The Result ist valid and i get all my Resources, but without any CustomProperties.
But i know these Properties exist, because using curl i get all my CustomProperties
The text was updated successfully, but these errors were encountered: