I have a Java Web application from which the user can add events with date, subject and description (like tasks). I want to send these events to the user's outlook calendar programmatically. Can anyone help me how to achieve this?
PS: If it can be done through Google Calendar tell me how to do that as I am not stuck with outlook :)
You can now use Outlook Calendar REST API and send requests from your java code.
For the auth flow see this getting started documentation.
Eg. POST to https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/events a JSON content like:
{
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
"Start": {
"DateTime": "2014-02-02T18:00:00",
"TimeZone": "Pacific Standard Time"
},
"End": {
"DateTime": "2014-02-02T19:00:00",
"TimeZone": "Pacific Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "janets@a830edad9050849NDA1.onmicrosoft.com",
"Name": "Janet Schorr"
},
"Type": "Required"
}
]
}
Google Calendar seems to be the best choice, as you can use the Google Calendar API. For an example written in Java, look here. Just make sure to note the GCal API usage limits.
Outlook doesn't seem to have some sort of an API, but maybe you can make use of or modify something like the Jpst or java-libpst.
Albert already answered for Google. For Outlook you use either OLE automation or Exchange web services.
Note that the second option is only for Outlook accounts talking to Exchange Server. If you access other mail backends through Outlook you can't use EWS, only use OLE.
You can also use the GCal RESTful API directly. The Java classes actually just wrap the REST calls.
And if you created events in Google Calendar you can subscribe to your Google Calendar from Outlook and have your events imported in Outlook too (although you have to use WebDAV for this)