开发者

Is there any open iCalender API? [closed]

开发者 https://www.devze.com 2023-03-17 11:24 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

Is there an开发者_如何学运维y API that I can use and post event data to (for example with querystrings) and get back a file that the visitor can download and add to his calender?

I can of course write the script myself, but if there is a open API I could save some time.


You could use iCal4j


You asked for a webservice of some sort, and I do not know of one, but if you are using .NET, you can create your own using this library:

http://www.codeproject.com/KB/vb/vcalendar.aspx


Maybe it's an option for you to generate and send an e-mail to the user containing the appointments you want the to add. By doing this you:

  • Haven't jo use any API
  • Use the build in auto-parsing feature of Apple Mail (Mac OS & iOS)
  • Stay compatible to other users which might not use iCal


I just used DDay.iCal which works fine for C#. You can see some documentation here on how to read/parse from an .ics file, and this is what i used to create a new file, checked it works on Outlook and on the iOS email application:

public static string GetCalendarAsString(string subject, DateTime start, DateTime end, 
                                         string location, string timeZoneName)
{
    var calendar = new iCalendar();
    var timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneName);
    calendar.AddTimeZone(iCalTimeZone.FromSystemTimeZone(timeZone));

    var evt = new Event
              {
                  Start = new iCalDateTime(start),
                  End = new iCalDateTime(end),
                  Location = location,
                  Summary = subject,
                  IsAllDay = false
              };

    calendar.Events.Add(evt);

    var serializer = new iCalendarSerializer();

    return serializer.SerializeToString(calendar);
}

you can use several other properties, although I only needed these


You can download iCal4J using http://sourceforge.net/projects/ical4j/files/iCal4j/1.0/ical4j-1.0.zip/download

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号