<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi all,</p>
    <p>I work at a small company that is also very interested in the
      shared calendars and addressbooks functionality.</p>
    <p>We did many tests and we came to the same conclusions about iOS
      devices mentioned here. The pull request Ellie mentioned
      (<a class="moz-txt-link-freetext" href="https://github.com/cyrusimap/cyrus-imapd/pull/2307">https://github.com/cyrusimap/cyrus-imapd/pull/2307</a>) was a bug
      that was discovered during that testing. <br>
    </p>
    <p>I am not an expert on DAV either, but me and the company I work
      for are also willing to also contribute in any way.<br>
    </p>
    <p>I must mention that we also tested shared calendars and
      addressbooks on android devices using DAVdroid. DAVdroid seems to
      work almost the same way as iOS devices (using principal URL,
      discovering all user's collections), but when using a shared
      collection URL as the account URL, that shared collection is also
      included in the available collections exposed by the app. The
      ideal would be for all shared collections the user has access to,
      to be discovered via a single URL.<br>
    </p>
    <p>Also, from iOS devices, besides "PROPFIND /dav/calendars/shared",
      a "PROPFIND /dav/calendars" seems to be performed too. I include
      here the response from Cyrus 3.0.5. Not sure if the response
      should include anything about the shared collections available on
      the server that the user has access to... <br>
    </p>
    <p>Request:<br>
    </p>
    <p><tt>Accept-Language: en-us</tt><tt><br>
      </tt><tt>Accept-Encoding: gzip, deflate</tt><tt><br>
      </tt><tt>Accept: */*</tt><tt><br>
      </tt><tt>Content-Type: text/xml</tt><tt><br>
      </tt><tt>Prefer: return=minimal</tt><tt><br>
      </tt><tt>Depth: 0</tt><tt><br>
      </tt><tt>Connection: keep-alive</tt><tt><br>
      </tt><tt>Authorization: Basic XXXXXXXXXXXXXX</tt><tt><br>
      </tt><tt>Content-Length: 181</tt><tt><br>
      </tt><tt>Brief: t</tt><tt><br>
      </tt><tt><br>
      </tt><tt><?xml version="1.0" encoding="UTF-8"?></tt><tt><br>
      </tt><tt><B:propfind xmlns:B="DAV:"></tt><tt><br>
      </tt><tt>  <B:prop></tt><tt><br>
      </tt><tt>    <B:current-user-principal/></tt><tt><br>
      </tt><tt>    <B:principal-URL/></tt><tt><br>
      </tt><tt>    <B:resourcetype/></tt><tt><br>
      </tt><tt>  </B:prop></tt><tt><br>
      </tt><tt></B:propfind></tt><br>
      <br>
      Response:</p>
    <p><tt>HTTP/1.1 207 Multi-Status</tt><tt><br>
      </tt><tt>Date: Thu, 05 Apr 2018 08:17:23 GMT</tt><tt><br>
      </tt><tt>Connection: Upgrade</tt><tt><br>
      </tt><tt>Upgrade: </tt><tt><br>
      </tt><tt>Vary: Accept-Encoding, Brief, Prefer</tt><tt><br>
      </tt><tt>Preference-Applied: return=minimal</tt><tt><br>
      </tt><tt>Content-Type: application/xml; charset=utf-8</tt><tt><br>
      </tt><tt>Content-Encoding: gzip</tt><tt><br>
      </tt><tt>Content-Length: 226</tt><tt><br>
      </tt><tt><br>
      </tt><tt><?xml version="1.0" encoding="UTF-8"?></tt><tt><br>
      </tt><tt><B:multistatus xmlns:B="DAV:"></tt><tt><br>
      </tt><tt>   <B:response></tt><tt><br>
      </tt><tt>      <B:href>/dav/calendars</B:href></tt><tt><br>
      </tt><tt>      <B:propstat></tt><tt><br>
      </tt><tt>         <B:prop></tt><tt><br>
      </tt><tt>            <B:current-user-principal></tt><tt><br>
      </tt><tt>              
        <B:href>/dav/principals/user/karagian/</B:href></tt><tt><br>
      </tt><tt>            </B:current-user-principal></tt><tt><br>
      </tt><tt>            <B:resourcetype></tt><tt><br>
      </tt><tt>               <B:collection /></tt><tt><br>
      </tt><tt>            </B:resourcetype></tt><tt><br>
      </tt><tt>         </B:prop></tt><tt><br>
      </tt><tt>         <B:status>HTTP/1.1 200 OK</B:status></tt><tt><br>
      </tt><tt>      </B:propstat></tt><tt><br>
      </tt><tt>   </B:response></tt><tt><br>
      </tt><tt></B:multistatus></tt><br>
    </p>
    <p><br>
    </p>
    <p>Please let me know if there is any way we can further contribute.<br>
    </p>
    <p>Regards,</p>
    <p>Savvas Karagiannidis<br>
    </p>
    <div class="moz-cite-prefix">On 9/4/2018 06:40, Anatoli wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:7813f924-c35b-5e93-f393-f694c5a2ea94@anatoli.ws">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div id="smartTemplate4-quoteHeader">
        <div style="font-size:10.0pt;font-family:Verdana,Arial"><font
            face="Verdana">Bron, Ken,<br>
            <br>
            Thanks for your explanations.<br>
            <br>
            Do you consider this is something possible to implement for
            an outside developer, i.e. without Cyrus HTTP/DB
            implementation internals understanding, nor solid knowledge
            of xDAV RFCs? I'd like to collaborate, but I believe it only
            makes sense to start this work if I could finish it without
            too much effort to become fluent with the related
            internals/standards.<br>
            <br>
            On the other hand, if I don't have a reasonable chance to
            implement it myself, could I sponsor the development by your
            team or help your team in other ways (e.g. extensive
            testing, logs/telemetry, etc.)?<br>
            <br>
            I have the Cyrus xDAV functionality deployed experimentally
            at one organization, everything looks good so far, but the
            fact that shared resources (calendars and addressbooks)
            can't be accessed from iOS devices obstructs its definitive
            deployment there and at other organizations. WebDAV
            resources work well on all devices with some minor issues on
            macOS (I'm debugging them now, looks like they only occur on
            previous versions of macOS, i.e. El Capitan).<br>
            <br>
            <br>
            > I originally wrote the code to handle public calendars
            in the "shared" namespace, but I focused on user calendars
            first, and public calendar support got tossed on the back
            burner.  It appears that the code for public calendars
            partly works.<br>
            <br>
            Public calendars actually work quite well, if the device can
            discover them. Currently, I've tested them with Thunderbird
            and haven't found any issues.<br>
            <br>
            Remote addressbooks are not supported in Thunderbird, so I
            use <i>CardBook</i> add-on and it works well with shared
            addressbooks, no issues detected. <i>Evolution</i> supports
            CardDAV natively and also works well with shared
            addressbooks.<br>
            <br>
            Regards,<br>
            Anatoli</font><br>
          <br>
        </div>
        <div style="border:none;border-top:solid #B5C4DF
          1.0pt;padding:3.0pt 0cm 0cm
0cm;font-size:10.0pt;font-family:"Tahoma","sans-serif""><b>From:</b>
          Ken Murchison<br>
          <b>Sent:</b> Saturday, April 07, 2018 21:53<br>
          <b>To:</b> Bron Gondwana, Cyrus Devel<br>
          <b>Cc:</b> Ken Murchison<br>
          <b>Subject:</b> Re: shared xDAV resources<br>
        </div>
        <br>
      </div>
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">I originally wrote the code to handle
        public calendars in the "shared" namespace, but I focused on
        user calendars first, and public calendar support got tossed on
        the back burner.  It appears that the code for public calendars
        partly works.  <br>
        <br>
        My first thought to get auto-discovery of public calendars is to
        add /dav/calendars as a second calendar-home-set for users and
        see what the Apple clients do with that.  I don't know if they
        can handle multiple home-sets.  If that doesn't work, then we
        could map public calendars into the user's home-set via the same
        subscription mechanism that we use for CalDAV sharing.<br>
        <br>
        To answer the original question, calendars are enumerated by
        meth_propfind() and propfind_by_collection() in http_dav.c<br>
        <br>
        <br>
        On 4/7/18 8:25 PM, Bron Gondwana wrote:<br>
      </div>
      <blockquote
cite="mid:1523147109.3986766.1330184448.5F04F251@webmail.messagingengine.com"
        type="cite">
        <title></title>
        <style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
        <div style="font-family:Arial;">Ken knows this code best.  I bet
          there's something which is requiring that there's a user on
          the mboxname because we implement the same behaviour at
          FastMail by having a separate user on which shared resources
          are kept.  The DAV resources are stored per-user, and without
          a place to keep them for "shared calendars" that code might
          just not be accessible.  I'm sure it would be possible to
          create a shared DAV database as well for this case, but it
          just needs some programming effort.<br>
        </div>
        <div style="font-family:Arial;"><br>
          Bron.<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>On Sun, 8 Apr 2018, at 07:30, Anatoli wrote:<br>
        </div>
        <blockquote type="cite">
          <div style="font-family:Arial;">Hi All,<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> I'm trying to understand the
            code responsible for enumerating user calendars (and xDAV
            resources in general) to try to make the discovery work for
            shared resources too (currently there's no way to access
            shared resources with Apple xDAV client implementation, yes
            with Thunderbird as it doesn't use the discovery mechanism,
            but instead should be pointed to the exact URL for each
            calendar). If I understand it correctly, the functionality
            is in imap/http_caldav.c.<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> Could you please point me to
            the place where the enumeration occurs and briefly mention
            how the general workflow looks like?<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> The client asks for:<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> <span class="font"
              style="font-family:"Courier New"">PROPFIND
              /dav/calendars/user/<user@domain>/<br>
              <br>
              <A:propfind xmlns:A="DAV:"><br>
              ...</span></div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> The server responds with:<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> <span class="font"
              style="font-family:"Courier New"">HTTP/1.1 207
              Multi-Status<br>
              <br>
              <A:multistatus xmlns:A="DAV:" ...><br>
                <A:response><br>
                 
              <A:href>/dav/calendars/user/<user@domain>/</A:href><br>
                  <A:propstat><br>
              ...<br>
                </A:response><br>
                <A:response><br>
                 
<A:href>/dav/calendars/user/<user@domain>/Default/</A:href><br>
                  <A:propstat><br>
                    <A:prop><br>
              ...</span></div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> The idea is to include in the
            returned lists the shared calendars too with the discovery
            logic based on the IMAP shared folders.<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> Below goes the initial
            exchange between the calendar app on iOS 10.2.6 and Cyrus
            3.0.5 when the exact URL (/dav/calendars/shared/) for the
            shared calendar is provided in the advanced settings of the
            app (the URL finally resets to the user principals folder
            (/dav/principals/user/t3@domain.com/) as iOS is pointed to
            it by Cyrus). In the attached file goes the telemetry for
            the rest of the communication.<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> Thanks,<br>
          </div>
          <div style="font-family:Arial;"> Anatoli<br>
          </div>
          <div style="font-family:Arial;"> <br>
          </div>
          <div style="font-family:Arial;"> <span class="font"
              style="font-family:"Courier New"">---------- <a
                moz-do-not-send="true" href="mailto:t3@domain.com">t3@domain.com</a>
              Sun Mar 25 06:05:36 2018<br>
              <br>
              <1521968736<<b>PROPFIND</b> <b>/dav/calendars/shared/</b>
              HTTP/1.1<br>
              Accept: */*<br>
              Content-type: text/xml<br>
              Connection: keep-alive<br>
              Content-length: 181<br>
              Host: mail.domain.com<br>
              User-agent: iOS/11.2.6 (15D100) accountsd/1.0<br>
              Prefer: return=minimal<br>
              Depth: 0<br>
              Brief: t<br>
              Accept-language: en-us<br>
              Authorization: Basic ...<br>
              Accept-encoding: br, gzip, deflate<br>
              <br>
              <1521968736<<?xml version="1.0"
              encoding="UTF-8"?><br>
              <A:propfind xmlns:A="DAV:"><br>
                <A:prop><br>
                  <A:current-user-principal/><br>
                  <A:principal-URL/><br>
                  <A:resourcetype/><br>
                </A:prop><br>
              </A:propfind><br>
              <br>
              <br>
              >1521968736>HTTP/1.1 207 Multi-Status<br>
              Date: Sun, 25 Mar 2018 09:05:36 GMT<br>
              Strict-Transport-Security: max-age=600<br>
              Vary: Accept-Encoding, Brief, Prefer<br>
              Preference-Applied: return=minimal<br>
              Content-Type: application/xml; charset=utf-8<br>
              Content-Length: 546<br>
              <br>
              <?xml version="1.0" encoding="utf-8"?><br>
              <A:multistatus xmlns:A="DAV:"
              xmlns:C="urn:ietf:params:xml:ns:caldav"><br>
                <A:response><br>
                  <A:href><b>/dav/calendars/shared/</b></A:href><br>
                  <A:propstat><br>
                    <A:prop><br>
                      <A:current-user-principal><br>
                        <A:href><b>/dav/principals/user/t3@domain.com/</b></A:href><br>
                      </A:current-user-principal><br>
                      <A:resourcetype><br>
                        <A:collection/><br>
                        <C:calendar/><br>
                      </A:resourcetype><br>
                    </A:prop><br>
                    <A:status>HTTP/1.1 200 OK</A:status><br>
                  </A:propstat><br>
                </A:response><br>
              </A:multistatus><br>
              <br>
              <1521968736<OPTIONS
              /dav/principals/user/t3%40domain.com/ HTTP/1.1<br>
              Host: mail.domain.com<br>
              Connection: keep-alive<br>
              Accept: */*<br>
              User-Agent: iOS/11.2.6 (15D100) accountsd/1.0<br>
              Accept-Language: en-us<br>
              Content-Length: 0<br>
              Accept-Encoding: br, gzip, deflate<br>
              <br>
              >1521968736>HTTP/1.1 200 OK<br>
              Date: Sun, 25 Mar 2018 09:05:36 GMT<br>
              Strict-Transport-Security: max-age=600<br>
              Cache-Control: no-cache<br>
              Link: </dav/principals/.server-info>;
              rel="server-info";
              token="80769c2c66d340ecd178710db26d56b9c4699e3e"<br>
              DAV: 1, 2, 3, access-control, extended-mkcol,
              resource-sharing<br>
              DAV: calendar-access, calendar-auto-schedule<br>
              DAV: calendar-query-extended, calendar-availability,
              calendar-managed-attachments<br>
              DAV: calendarserver-sharing, inbox-availability<br>
              DAV: addressbook<br>
              Allow: OPTIONS, GET, HEAD<br>
              Allow: PROPFIND, REPORT, COPY<br>
              Content-Length: 0</span> </div>
          <p>Email had 1 attachment:<br>
          </p>
          <ul>
            <li>
              <div style="font-family:Arial;"><code>telemetry.log</code><br>
              </div>
              <div style="font-family:Arial;">  36k (text/x-log)<br>
              </div>
            </li>
          </ul>
        </blockquote>
        <div style="font-family:Arial;"><br>
        </div>
        <div id="sig56629417">
          <div class="signature">--<br>
          </div>
          <div class="signature">  Bron Gondwana, CEO, FastMail Pty Ltd<br>
          </div>
          <div class="signature">  <a class="moz-txt-link-abbreviated"
              href="mailto:brong@fastmailteam.com"
              moz-do-not-send="true">brong@fastmailteam.com</a><br>
          </div>
          <div class="signature"><br>
          </div>
        </div>
        <div style="font-family:Arial;"><br>
        </div>
      </blockquote>
      <br>
      <p><br>
      </p>
      <pre class="moz-signature" cols="72">-- 
Kenneth Murchison
Cyrus Development Team
FastMail Pty Ltd</pre>
      <br>
    </blockquote>
    <br>
  </body>
</html>