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 :)
In Google Calendar settings, go to “Events from Gmail,” and check the box next to "Show events automatically created by Gmail in my calendar."
You can also sync your Google Calendar to your Outlook.com account. If you have a paid G Suite account, you can use the G Suite Sync for Microsoft Outlook tool. Outlook can automatically sync with a Google Calendar when you use Outlook on mobile devices for iOS and Android operating systems.
The calendar API lets you get calendar items of the signed-in user, or users who have shared or delegated their calendars to the signed-in user.
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": "[email protected]",
"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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With