[CalendarServer-users] CalDav and iCal intergration

Andre LaBranche dre at apple.com
Mon May 2 13:33:51 PDT 2011


On May 2, 2011, at 12:29 PM, John Clark wrote:

> HI
>  
> I am building an online appointments app which I would like to integrate with ical.
>  
> The biggest issue I'm having is that while I can get a script to connect and log in via CalDav, I can't get to a specific calendar in order to test adding & removing. Essentially I can connect to your iCal instance viahttps://cal.me.com/principals/users/blahblah@me.com/ and theusername / password however all this gives me is a directory overview page (perhaps for file storage?) and does not allow me to access any other folders as far as I can work out.
>  
> The problem seems to be that to access a calendar you need to use a specific url in a specific format but I can't seem to find that online.
>  
> Is there anyone out there that can help?

This list is focused on iCal Server as opposed to Mobile Me's services, but this question seems fairly generic...

We (iCal Server) have a diagnostic tool called CalDAVClientLibrary, which provides an interactive CalDAV command-line shell - useful for exploring CalDAV services. When I connect to my mobile me calendar, I see:

./runshell.py --server https://cal.me.com/principals/users/dre@me.com/
User: dre
Password: 
/ > ls

(no results)

Against an iCal Server, the 'ls' would have displayed the server's document root:

andre at xomg[CalendarServer/CalDAVClientLibrary]./runshell.py --server https://redacted.lompywickets.com                          
User: dre
Password: 
/ > ls
.calendarserver_version  
.well-known/             
addressbooks/            
admin/                   
calendars/               
directory/               
principals/              
timezones                
webcal/ 

Digging around a bit, I think I have a method (but perhaps not the correct / expected method) to find the user's mobile me calendars.

1) Log in with CalDAVClientLibrary, get properties for the document root:

andre at xomg[CalendarServer/CalDAVClientLibrary]./runshell.py --server https://cal.me.com
User: dre at mac.com
Password: 
/ > props /
OK Properties:
    {DAV:}acl-restrictions: 
    {DAV:}creationdate: 2011-05-02T13:23:59Z
    {DAV:}current-user-principal: URL: /principals/users/1.9979107/
    {DAV:}current-user-privilege-set: <Element '{DAV:}current-user-privilege-set' at 0x10e3852d0>
    {DAV:}displayname: tmp
    {DAV:}getcontentlength: 
    {DAV:}getcontenttype: httpd/unix-directory
    {DAV:}getetag: "9E0001-1000-4DBF12DF"
    {DAV:}getlastmodified: Mon, 02 May 2011 13:23:59 GMT
    {DAV:}inherited-acl-set: 
    {DAV:}principal-collection-set: URL: /principals/
    {DAV:}resourcetype: <Element '{DAV:}resourcetype' at 0x10e387710>
    {DAV:}supported-privilege-set: <Element '{DAV:}supported-privilege-set' at 0x10e385990>
    {DAV:}supported-report-set: <Element '{DAV:}supported-report-set' at 0x10e387c90>
    {DAV:}supportedlock: <Element '{DAV:}supportedlock' at 0x10e387890>
    {http://twistedmatrix.com/xml_namespace/dav/}resource-class: MMRootResource
Failed Properties:
    {DAV:}acl: 401


2) Observe the value of the current-user-principal attribute. In my case, /principals/users/1.9979107/

I'm not sure what that number is called or how it's derived, but it's probably specified in some spec somewhere :) Anyway, onward:

3) Use the 'user number' as the last component of a /calendars/users/ path, as shown here:

/ > cd /calendars/users/1.9979107
/calendars/users/1.9979107 > ls
BBE4AA14-58E6-46F3-B0E7-B86F66E81390/           
M2CD-1-1-6981CC60-E068-44C4-AA9B-6F65C8F25764/  
inbox/                                          
notification/ 

Now we see my calendars. You can see the http traffic by issuing the 'logging' command within CalDAVClientLibrary as shown below. Be advised that the string shown in the Authorization: Basic line contains sensitive information and should be obfuscated prior to 'sharing' :)

/calendars/users/1.9979107 > props /

        <-------- BEGIN HTTP CONNECTION -------->
Server: cal.me.com

        <-------- BEGIN HTTP REQUEST -------->
PROPFIND / HTTP/1.1
Host: cal.me.com:443
Authorization: Basic ZHALSO89D7FREDACTED879MORE8445WICKETS88THAT88AREW45RLOMPYMjY=
Content-Length: 110
Content-Type: text/xml; charset=utf-8
Depth: 0

<?xml version='1.0' encoding='utf-8'?>
<ns0:propfind xmlns:ns0="DAV:">
  <ns0:propname />
</ns0:propfind>

        <-------- BEGIN HTTP RESPONSE -------->
HTTP/1.1 207 Multi-Status
Content-Length: 547
Accept-Ranges: bytes
Server: MobileMeCalendarServer 1C78
Last-Modified: Mon, 02 May 2011 20:26:37 GMT
DAV: 1, access-control, calendar-access, calendar-schedule, calendar-auto-schedule, calendarserver-sharing, calendarserver-subscribed, calendarserver-principal-property-search
ETag: "9E0001-1000-4DBF137D"
Date: Mon, 02 May 2011 20:28:12 GMT
X-Transaction-Id: nk11r10me-calsvr026-9-1303950232-3081494
X-Responding-Server: nk11r10me-calsvr026 9 
Content-Type: text/xml
<?xml version='1.0' encoding='UTF-8'?><multistatus xmlns='DAV:'><response><href>/</href><propstat><prop><getlastmodified/><supportedlock/><acl-restrictions/><acl/><current-user-privilege-set/><resource-class xmlns='http://twistedmatrix.com/xml_namespace/dav/'/><supported-report-set/><principal-collection-set/><getetag/><displayname/><inherited-acl-set/><creationdate/><resourcetype/><getcontentlength/><current-user-principal/><getcontenttype/><supported-privilege-set/></prop><status>HTTP/1.1 200 OK</status></propstat></response></multistatus> 
        <-------- END HTTP RESPONSE -------->

        <-------- END HTTP CONNECTION -------->

        <-------- BEGIN HTTP CONNECTION -------->
Server: cal.me.com

        <-------- BEGIN HTTP REQUEST -------->
PROPFIND / HTTP/1.1
Host: cal.me.com:443
Authorization: Basic ZHALSO89D7FREDACTED879MORE8445WICKETS88THAT88AREW45RLOMPYMjY=
Content-Length: 678
Content-Type: text/xml; charset=utf-8
Depth: 0

<?xml version='1.0' encoding='utf-8'?>
<ns0:propfind xmlns:ns0="DAV:">
  <ns0:prop>
    <ns0:principal-collection-set />
    <ns0:creationdate />
    <ns0:current-user-privilege-set />
    <ns0:acl-restrictions />
    <ns0:current-user-principal />
    <ns0:getlastmodified />
    <ns0:supported-privilege-set />
    <ns0:getcontenttype />
    <ns0:resourcetype />
    <ns0:getetag />
    <ns0:inherited-acl-set />
    <ns0:supportedlock />
    <ns0:displayname />
    <ns0:getcontentlength />
    <ns1:resource-class xmlns:ns1="http://twistedmatrix.com/xml_namespace/dav/" />
    <ns0:acl />
    <ns0:supported-report-set />
  </ns0:prop>
</ns0:propfind>

        <-------- BEGIN HTTP RESPONSE -------->
HTTP/1.1 207 Multi-Status
Content-Length: 3200
Accept-Ranges: bytes
Server: MobileMeCalendarServer 1C78
Last-Modified: Mon, 02 May 2011 20:26:34 GMT
DAV: 1, access-control, calendar-access, calendar-schedule, calendar-auto-schedule, calendarserver-sharing, calendarserver-subscribed, calendarserver-principal-property-search
ETag: "1DE0001-1000-4DBF137A"
Date: Mon, 02 May 2011 20:28:13 GMT
X-Transaction-Id: nk11r10me-calsvr002-7-1303949901-4344863
X-Responding-Server: nk11r10me-calsvr002 7 
Content-Type: text/xml
<?xml version='1.0' encoding='UTF-8'?><multistatus xmlns='DAV:'><response><href>/</href><propstat><prop><principal-collection-set><href>/principals/</href></principal-collection-set><creationdate>2011-05-02T13:26:34Z</creationdate><current-user-privilege-set><privilege><read/></privilege><privilege><read-current-user-privilege-set/></privilege></current-user-privilege-set><acl-restrictions/><current-user-principal><href>/principals/users/1.9979107/</href></current-user-principal><getlastmodified>Mon, 02 May 2011 13:26:34 GMT</getlastmodified><supported-privilege-set><supported-privilege><privilege><all/></privilege><description xml:lang='en'>all privileges</description><supported-privilege><privilege><read/></privilege><description xml:lang='en'>read resource</description></supported-privilege><supported-privilege><privilege><write/></privilege><description xml:lang='en'>write resource</description><supported-privilege><privilege><write-properties/></privilege><description xml:lang='en'>write resource properties</description></supported-privilege><supported-privilege><privilege><write-content/></privilege><description xml:lang='en'>write resource content</description></supported-privilege><supported-privilege><privilege><bind/></privilege><description xml:lang='en'>add child resource</description></supported-privilege><supported-privilege><privilege><unbind/></privilege><description xml:lang='en'>remove child resource</description></supported-privilege></supported-privilege><supported-privilege><privilege><unlock/></privilege><description xml:lang='en'>unlock resource without ownership of lock</description></supported-privilege><supported-privilege><privilege><read-acl/></privilege><description xml:lang='en'>read resource access control list</description></supported-privilege><supported-privilege><privilege><write-acl/></privilege><description xml:lang='en'>write resource access control list</description></supported-privilege><supported-privilege><privilege><read-current-user-privilege-set/></privilege><description xml:lang='en'>read privileges for current principal</description></supported-privilege></supported-privilege></supported-privilege-set><getcontenttype>httpd/unix-directory</getcontenttype><resourcetype><collection/></resourcetype><getetag>"1DE0001-1000-4DBF137A"</getetag><inherited-acl-set/><supportedlock><lockentry><lockscope><exclusive/></lockscope><locktype><write/></locktype></lockentry><lockentry><lockscope><shared/></lockscope><locktype><write/></locktype></lockentry></supportedlock><displayname>tmp</displayname><getcontentlength/><resource-class xmlns='http://twistedmatrix.com/xml_namespace/dav/'>MMRootResource</resource-class><supported-report-set><supported-report><report><acl-principal-prop-set/></report></supported-report><supported-report><report><principal-match/></report></supported-report><supported-report><report><principal-property-search/></report></supported-report><supported-report><report><expand-property/></report></supported-report></supported-report-set></prop><status>HTTP/1.1 200 OK</status></propstat><propstat><prop><acl/></prop><status>HTTP/1.1 401 Unauthorized</status></propstat></response></multistatus> 
        <-------- END HTTP RESPONSE -------->

        <-------- END HTTP CONNECTION -------->
OK Properties:
    {DAV:}acl-restrictions: 
    {DAV:}creationdate: 2011-05-02T13:26:34Z
    {DAV:}current-user-principal: URL: /principals/users/1.9979107/
    {DAV:}current-user-privilege-set: <Element '{DAV:}current-user-privilege-set' at 0x10e385590>
    {DAV:}displayname: tmp
    {DAV:}getcontentlength: 
    {DAV:}getcontenttype: httpd/unix-directory
    {DAV:}getetag: "1DE0001-1000-4DBF137A"
    {DAV:}getlastmodified: Mon, 02 May 2011 13:26:34 GMT
    {DAV:}inherited-acl-set: 
    {DAV:}principal-collection-set: URL: /principals/
    {DAV:}resourcetype: <Element '{DAV:}resourcetype' at 0x10e38b750>
    {DAV:}supported-privilege-set: <Element '{DAV:}supported-privilege-set' at 0x10e2f9e10>
    {DAV:}supported-report-set: <Element '{DAV:}supported-report-set' at 0x10e38b110>
    {DAV:}supportedlock: <Element '{DAV:}supportedlock' at 0x10e38b490>
    {http://twistedmatrix.com/xml_namespace/dav/}resource-class: MMRootResource
Failed Properties:
    {DAV:}acl: 401
/calendars/users/1.9979107 > 


HTH,
-dre


>  
> REgards
>  
>  
> JOhn
> 
> _______________________________________________
> calendarserver-users mailing list
> calendarserver-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/calendarserver-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-users/attachments/20110502/eb7fccbc/attachment-0001.html>


More information about the calendarserver-users mailing list