Linking to Outlook Calendar

Posted by James Palmer on 27-Feb-2014 06:29

We currently have a calendar system in our application which we have developed ourselves. It works nicely, but it does require the user to log in to the application to see his/her appointments for the day. I'd love to be able to enhance it to also create Outlook calendar appointments. Does anyone know of a library I can tap into for such purposes? Ideally I'd want it to create appointments, amend existing ones on meeting amend, and delete them on delete. Obviously the meetings will be for more than just the currently logged in user which might be where this becomes a problem. No idea if it's possible to programatically create appointments for someone else in Outlook?

The application is an in-house system in OE11.2.1 GUI. All users have Outlook installed on the machine they access the application through. 

All Replies

Posted by Peter Judge on 27-Feb-2014 08:54

James,
 
Take a look at some of the stuff Bruce Gruenbaum (a former long-time Progress user) did with Exchange: http://www.thesoftwaregorilla.com/2010/05/exchange-web-services-example-part-2-creating-appointments/ . That link has a number of companion pieces. Hopefully it'll be useful.
 
-- peter
 
[collapse]
From: James Palmer [mailto:bounce-jdpjamesp@community.progress.com]
Sent: Thursday, 27 February, 2014 07:30
To: TU.OE.Development@community.progress.com
Subject: [LIKELY JUNK]Linking to Outlook Calendar
 
Thread created by James Palmer

We currently have a calendar system in our application which we have developed ourselves. It works nicely, but it does require the user to log in to the application to see his/her appointments for the day. I'd love to be able to enhance it to also create Outlook calendar appointments. Does anyone know of a library I can tap into for such purposes? Ideally I'd want it to create appointments, amend existing ones on meeting amend, and delete them on delete. Obviously the meetings will be for more than just the currently logged in user which might be where this becomes a problem. No idea if it's possible to programatically create appointments for someone else in Outlook?

The application is an in-house system in OE11.2.1 GUI. All users have Outlook installed on the machine they access the application through. 

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by James Palmer on 27-Feb-2014 09:03

Thanks Peter I'll take a look.

Posted by tbergman on 27-Feb-2014 17:10

This is pretty easy with .Net. You'll need to download and install the Microsoft Exchange Web Services Managed API 2.1. Then add a reference to your assemblies file.

Here's some sample code I was playing with.

USING System.*.

USING Microsoft.Exchange.WebServices.Data.*.

USING System.Net.Security.*.

USING System.Security.Cryptography.X509Certificates.*.

DEFINE VARIABLE service   AS ExchangeService.  

DEFINE VARIABLE oBody     AS Microsoft.Exchange.WebServices.Data.MessageBody.

DEFINE VARIABLE appt      AS Appointment.

DEFINE VARIABLE ApptStart AS DATETIME.

DEFINE VARIABLE ApptEnd   AS DATETIME.

apptStart = NOW.

apptEnd = NOW + 3600000.

service = NEW ExchangeService(ExchangeVersion:Exchange2010) .

service:credentials = NEW WebCredentials("<some exchange account>", "<some exchange password>").

service:AutodiscoverUrl("<some exchange account>").

oBody = NEW Microsoft.Exchange.WebServices.Data.MessageBody().

appt = NEW Appointment(service).

oBody:BodyType = BodyType:HTML.

oBody:Text = "My test <B>New Test appt</B>".

appt:Body = oBody.

appt:Start = ApptStart.

appt:End = ApptEnd.

appt:Save().

MESSAGE "done"

   VIEW-AS ALERT-BOX.

Posted by tbergman on 27-Feb-2014 17:23

I should probably have said creating a basic appointment is easy. Not sure about the rest but the API looks pretty complete.

This does not require Outlook .

Posted by Marian Edu on 28-Feb-2014 00:40

This will work if the user's mailbox is on an Exchange server, if that is not the case the only option will be the good old Outlook MAPI (COM interface) - msdn.microsoft.com/.../jj900714%28v=office.15%29.aspx

If Exchange is used direct web-service access (EWS) can also be used, if managed .NET version mentioned by Tom doesn't work for you. We have that working for calendar, tasks and contacts. If Office365 is used the managed EWS will need some tweaks to make it accept the ssl certificate and be aware of proxy settings in IE as those are going to be used by EWS as well (by default).

Posted by oedev on 28-Feb-2014 04:52

Hi James,

I've had a look at doing something similar in the past, and found the libraries available at www.independentsoft.com/.../index.html to be very comprehensive and easy to use. Not expensive and free run-time.

Note there are 2 versions available, the later versions of Outlook expose functionality via web services, and the libraries provided by this company provide easy to use helper classes exposing that functionality. 

They also do allow you to create entries in other users calendars, an C# example from their site is shown below, looks pretty easy to convert to OE.

using System;
using System.Net;
using Independentsoft.Exchange;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            NetworkCredential credential = new NetworkCredential("username", "password");
            Service service = new Service("https://myserver/ews/Exchange.asmx", credential);

            try
            {
                Mailbox johnMailbox = new Mailbox("John@mydomain.com");
                StandardFolderId johnCalendarFolder = new StandardFolderId(StandardFolder.Calendar, johnMailbox);
                
                Appointment appointment = new Appointment();
                appointment.Subject = "Test";
                appointment.Body = new Body("Body text");
                appointment.StartTime = DateTime.Today.AddHours(15);
                appointment.EndTime = DateTime.Today.AddHours(16);
                appointment.Location = "My Office";
                appointment.ReminderIsSet = true;
                appointment.ReminderMinutesBeforeStart = 30;

                ItemId itemId = service.CreateItem(appointment, johnCalendarFolder);
            }
            catch (ServiceRequestException ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.WriteLine("Error: " + ex.XmlMessage);
                Console.Read();
            }
            catch (WebException ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.Read();
            }
        }
    }
}
              


HTH.

Posted by James Palmer on 28-Feb-2014 04:57

Thanks for the input folks. Something to look at for a rainy day! :D

Posted by thomas.rothlisberger on 29-May-2014 01:17

Hi

I started to play with the Microsoft Exchange Web Services Managed API 2.1. and creating an appointment is fine. I am now interested how I would read the calendar for a particular person and was wondering if anybody has some code samples to share.

thanks in advance

Thomas

Posted by S33 on 27-Jan-2015 10:55

Looks like this thread has lain dormant for a while. Does anyone have success to report?

I have client looking to have me populate Outlook tasks from Linux based CHUI Progress (10.2b). Do we think that would be feasible? Are there extra hurdles coming from Linux?

This thread is closed