diff --git a/src/java/davmail/caldav/CaldavConnection.java b/src/java/davmail/caldav/CaldavConnection.java index 5d029b33..34d7d230 100644 --- a/src/java/davmail/caldav/CaldavConnection.java +++ b/src/java/davmail/caldav/CaldavConnection.java @@ -924,6 +924,10 @@ public class CaldavConnection extends AbstractConnection { response.startResponse(URIUtil.encodePath("/principals/" + prefix + '/' + principal)); response.startPropstat(); + if (request.hasProperty("principal-URL")) { + response.appendProperty("D:principal-URL", "/principals/" + prefix + '/' + principal); + } + if (request.hasProperty("calendar-home-set")) { if ("users".equals(prefix)) { response.appendHrefProperty("C:calendar-home-set", "/users/" + actualPrincipal + "/calendar/"); diff --git a/src/test/davmail/caldav/TestCaldav.java b/src/test/davmail/caldav/TestCaldav.java index 4cf09d5f..6b064a78 100644 --- a/src/test/davmail/caldav/TestCaldav.java +++ b/src/test/davmail/caldav/TestCaldav.java @@ -350,5 +350,13 @@ public class TestCaldav extends AbstractDavMailTestCase { assertEquals(HttpStatus.SC_MOVED_PERMANENTLY, method.getStatusCode()); } + public void testPrincipalUrl() throws IOException, DavException { + DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet(); + davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:"))); + PropFindMethod method = new PropFindMethod("/principals/users/"+session.getEmail(), davPropertyNameSet, 0); + httpClient.executeMethod(method); + method.getResponseBodyAsMultiStatus(); + assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode()); + } }