Jump to content
emileverh

Access multiple Outlook calendars

Recommended Posts

Hi team!

I have a question; I have a situation where a secretary manages multiple calendars in Outlook. So from her manager, employee 1, employee 2, etc. Is it possible to get access to all calendars of all people? For example I want to put an appointment in the calendar of 'Employee 2' via Delphi 12.

 

I now use the 'basic' access like:

try

  myOutlook := GetActiveOleObject('Outlook.Application');
except

  myOutlook := CreateOleObject('Outlook.Application');

end;

etc. etc.

And that works. ( I use it for sending emails ). But I don't know you to use multiple calendars....

 

Your help would be much appreciated!

Thanks in advance,
Emile

Share this post


Link to post

Have  you checked Microsoft's documentation?

Does it indicate that it should be possible?

Share this post


Link to post

Yes, but it's loooooooots of things to read and every item is hyperlinked to another page. So I miss the overview. I hope(d) that some could say, yes I have done this before and do this (fake code): calendar.User[2].AddAppointment

Share this post


Link to post

if they are o365 accounts, you could take a look at the Microsoft Graph API instead. 

maybe worth instead of doing it the "old way".

 

Share this post


Link to post

It has little to do with the topic, but with the entry into force of the DMA (European Digital Markets Act) in Europe the automatic login of applications linked to a particular account will most likely be changed. It seems that when you start the application you will be asked for the account to use for that application, effectively eliminating the possibility of automatic login. So if a "CreateOleObject" is executed, further operator action may be required. All this is a hypothesis for now, we are waiting for what and how the service provider companies (such as Microsoft for e-mail for example) will implement everything.

 

https://commission.europa.eu/strategy-and-policy/priorities-2019-2024/europe-fit-digital-age/digital-markets-act-ensuring-fair-and-open-digital-markets_en

 

This is relevant in my sector (industries), because all activities should be automatic... let's hope that the changes do not imply a distortion of the authentication logic.

Share this post


Link to post

Outlook's contact info is a vcard file and calendar event is vcalendar *.vcs or *.ics file. The employee calendar shows the events provided by the calendars the employee has access to. 


Example of email attachment
https://answers.microsoft.com/en-us/outlook_com/forum/all/how-to-insert-attachment-to-recurring-meeting 

You would simply add an event attachment to the email of employee.

 

But better to educate the office staff how to use Outlook calendar by having the secretary set the events on the employee calendars as needed. 

Employee leave requests are sent to office manager. If approved the secretary amends the department's calendar which updates the employee calendar.

The employee looks at the calendar events provided by the secretary. The secretary knows when the employee knows of a calendar event by the employee opening an email with a calendar event attachment and confirming the event.

  
 

Share this post


Link to post
15 minutes ago, Pat Foley said:

Outlook's contact info is a vcard file and calendar event is vcalendar *.vcs or *.ics file. The employee calendar shows the events provided by the calendars the employee has access to. 


Example of email attachment
https://answers.microsoft.com/en-us/outlook_com/forum/all/how-to-insert-attachment-to-recurring-meeting 

You would simply add an event attachment to the email of employee.

 

But better to educate the office staff how to use Outlook calendar by having the secretary set the events on the employee calendars as needed. 

Employee leave requests are sent to office manager. If approved the secretary amends the department's calendar which updates the employee calendar.

The employee looks at the calendar events provided by the secretary. The secretary knows when the employee knows of a calendar event by the employee opening an email with a calendar event attachment and confirming the event.

  
 

Thanks for your answer. First the link does not work. And second my application is a planning tool where lots of mutations are done during the day. And adding email with attachments is not a good option ( we tought of that), because there will be a lots of mouse click work than and I don't want to run VBA scripts. Therefore I want full access to the local application, where the secretary has access to xxx employees. And I want to add/remove directly into Outlook. It already works for 1 calendar. But now I want to address one specific calendar.....that is my question

  • Like 1

Share this post


Link to post
Posted (edited)

Using ChatGPT I got some helpful basic steps:

 

Q: How can a Delphi application use the Outlook.Application ActiveX to read a user calendar?

A: To use the Outlook.Application ActiveX in a Delphi application to read a user's calendar, you can follow these general steps. Please note that you need to have Outlook installed on the machine where your Delphi application is running.

(Steps and source code omitted)

 


Q: Is it also possible to read the calendar of a different user?

A: Accessing the calendar of a different user using the Outlook.Application ActiveX in Delphi depends on the permissions and configuration of the Outlook profile. Generally, the ability to access another user's calendar requires the appropriate permissions and security settings.
(Again, steps and code omitted here, except the following two lines:
 
    // Replace 'otheruser@example.com' with the email address of the user whose calendar you want to access
    OtherUserCalendar := Namespace.GetSharedDefaultFolder('otheruser@example.com', olFolderCalendar);


I do not post more as I am not sure if AI-generated answers are acceptable in this forum

 

----

Note: using the MS Graph API (or EWS) may be also an option, with the advantage that no local Outlook is required.

 

Edited by mjustin

Share this post


Link to post

Looks interesting. I will try that! Thanks for your help ;-))

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×