问题描述
我想我的手机的日历应用程序(Windows桌面应用程序和Web应用程序)集成。
I'm trying to integrate my application (Windows desktop app, and Web app) with mobile calendars.
我的应用程序应该
- 推新活动,以手机日历
- 获取事件形成移动日历
到目前为止,我设法与谷歌日历整合(很容易,的 +的OAuth)
So far I managed to integrate with Google calendar (very easy, simple library + OAuth)
现在我想要做的iCloud日历一样,但它不是那么容易。
Now I want to do the same with iCloud calendar, but it's not that easy.
- 在iCould设置,我可以公开自己的日历。比我可以获取事件(作为iCalendar档案),但我不能推的事件。
- 的找不到iCould日历集成任何严重的库。我给一试,但需要提供的CalDAV服务器URL。根据应该看起来像<$ C这$ C> https://pXX-caldav.icloud.com/USER_ID/calendars/CALENDAR_ID 。我不知道是什么
USER_ID
和CALENDAR_ID
在哪里可以找到他们。
- In iCould settings I can make a calendar public. Than I can fetch events (as a iCalendar file), but I cannot push events.
- The cannot find any serious libraries for iCould calendar integration. I gave CalDav.Client a try, but need to provide CalDAV server url. which according to this should look like"
https://pXX-caldav.icloud.com/USER_ID/calendars/CALENDAR_ID
. I have no idea whatUSER_ID
andCALENDAR_ID
are and where to find them.
任何想法?
PS
有一种变通方法,我可以要求用户与日历一起创建一个谷歌户头,并用它作为一个代理。整合IPhone与谷歌日历,并形成其他网站整合我与谷歌日历应用程序,它的工作原理,但配置是一种对用户的繁琐。
There is a workaround. I can ask user to create a Google accout along with a calendar and use it as a proxy. Integrate IPhone with Google calendar and form the other site integrate my application with Google calendar. It works, but the configuration is kind of tedious for the user.
修改
我试过以下@ HNH的说明和发现的CalDAV是这样的:
I tried following @hnh's instructions and discover CalDAV this way:
PROPFIND https://p42-caldav.icloud.com/ HTTP/1.1
Depth: 0
Prefer: return-minimal
Content-Type: application/xml; charset=utf-8
Host: p42-caldav.icloud.com
Content-Length: 102
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:current-user-principal />
</d:prop>
</d:propfind>
结果是401:
The result was 401:
HTTP/1.1 401 Unauthorized
Content-Type: text/html;charset=utf-8
WWW-Authenticate: x-mobileme-authtoken realm="MMCalDav"
WWW-Authenticate: basic realm="MMCalDav"
Server: iCloudCalendarServer 15G33
Date: Tue, 26 Jan 2016 12:46:14 GMT
X-Responding-Server: mr26p42ic-ztdg05101801 17 a63660a6f7d1a25b5a7ed66dab0da843
X-Transaction-Id: c8dc19d4-c42a-11e5-8381-008cfaeb448c
Content-Length: 141
Strict-Transport-Security: max-age=31536000; includeSubDomains
<html><head><title>Unauthorized</title></head><body><h1>Unauthorized</h1><p>You are not authorized to access this resource.</p></body></html>
编辑2
经过进一步说明我设法认证,但是仍然有从文章的要求问题:
Following further instructions I managed to authenticate, but still have problems with the requests from the article:
有关:
<d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
<d:prop>
<d:displayname />
<cs:getctag />
</d:prop>
</d:propfind>
我得到:( CTAG
未找到,和显示名
与TMP的价值 - 我不认识)
I get: (ctag
not found, and displayName
with value of "tmp" - which I don't recognize)
<?xml version='1.0' encoding='UTF-8'?>
<multistatus xmlns='DAV:'>
<response>
<href>/</href>
<propstat>
<prop>
<displayname>tmp</displayname>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<getctag xmlns='http://calendarserver.org/ns/'/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
</multistatus>
和本:
<c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
<d:prop>
<d:getetag />
<c:calendar-data />
</d:prop>
<c:filter>
<c:comp-filter name="VCALENDAR" />
</c:filter>
</c:calendar-query>
我得到400错误的请求
I get 400 Bad Request
推荐答案
这是一个很好的介绍:。它还介绍了日历发现过程是如何工作的(你是怎么找到日历homeset URL)。
This is a nice introduction: Building a CalDAV client. It also describes how the calendar discovery process works (how you find the calendar homeset URL).
很多的CalDAV服务器不支持OAuth的,你通常要问的用户的登录/密码。
Many CalDAV servers do not support OAuth, you'll usually have to ask the user for login/password.
似乎没有成为一个CalDAV的.NET库。你可以找到实现的列表在这里:
There doesn't seem to be a .NET library for CalDAV. You can find a list of implementations over here: http://caldav.calconnect.org/implementations/librariestools.html.
摘要:也许不是那么容易,因为你与谷歌做了什么,而不是超硬无论是。一旦你拥有它,你可以连接到许多不同的服务器,因为的CalDAV是一个标准的...(包括谷歌,你可以连接到使用CalDAV以及)。
Summary: Probably not as easy as what you did with Google, but not super hard either. And once you have it, you can connect to many different servers, given that CalDAV is a standard ... (including Google, you can connect to that with CalDAV as well).
问题的编辑后更新:
401是一种通用的。这意味着你需要提供凭据才能继续申请。客户端通常会提示输入登录/密码的用户,然后重新运行该请求。基本身份验证是维基百科的文章中很好的描述。
The 401 is a generic HTTP response. It means that you need to provide credentials to continue with the request. A client would usually prompt the user for login/password and then re-run the request. Basic authentication is well described in the Wikipedia article on Basic auth.
另一个错误是使用 p42-caldav.icloud.com
为切入点URL。使用 caldav.icloud.com
因为你不知道用户是在哪个分区。您需要使用的发现过程rel=\"nofollow\">建设的CalDAV客户找到
这篇关于如何推动事件IPhone日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!