Publish MS Exchange calendar file for collaboration - c#

I have an application that holds calendar data / events and now i want people to access this data through Microsoft Outlook (optionally with Exchange as source) as well.
I want to enable them to add the calendar to Outlook, see the events (as every other Outlook/Exchange calendar), but they also should be able to edit the events as well.
I have seen that Outlook can read ICS files. But i dont think that Outlook can write / alter these files as well.
Is there someone who has a good idea / tool / practice on how to do this job?
My idea is that the best way to accomplish this, is via Exchange. Are there possibilities for my application to sync with a shared calendar in Exchange?

Outlook can save appointments as ICS files just fine (AppoinmmentItem.SaveAs(.., olICal), the problem is that when you double click on an ICS file, Outlook crates a temporary appointment in its store, so when you modify and save the appointment, the changes will not be persisted in the original ICS file.
Why not programmatically create a separate folder in Outlook and export your appointments there? You can detect changes in that folder and copy the modified appointment back to your application if necessary.

Related

Office.context.roamingSettings.get(key) alternative function in VSTO c# project

I am developing a VSTO project where i want to save some user data using roaming settings
i searched for it and it is applicable only in javascript office.js
Is there any alternative that i can use in my VSTO project?
using Outlook = Microsoft.Office.Interop.Outlook;
You can save user settings in the user roaming profile. To add a user setting, go to project properties (right click the project => Properties), then navigate to the "Settings" tab and add your user setting there:
https://learn.microsoft.com/en-us/visualstudio/ide/reference/settings-page-project-designer
JS addin roaming settings are stored in the Exchange mailbox outside of the visible (IPM) folder tree. Outlook itself stores its global settings (e.g., categories etc.) in a hidden message (each folder has two contents tables - regular and hidden) in one of the default folders, such as Inbox or Calendar - you can see those messages in OutlookSpy (I am its author) - click IMAPIFolder button, go to the "Associated Contents" tab.
You can access these message in your VSTO project through MAPIFolder.GetStorage.
You can use hidden items in Outlook. That is how roaming settings are stored by web add-ins. The Outlook object model provides the StorageItem object which is stored at the folder level, allowing it to roam with the account and be available online or offline.
The Outlook object model does not provide any collection object for StorageItem objects. However, you can use Folder.GetTable to obtain a Table with all the hidden items in a Folder, when you specify the TableContents parameter as olHiddenItems. Be aware, if keeping your data private is of a high concern, you should encrypt the data before storing it.
Once you have obtained a StorageItem object, you can do the following to store solution data:
Add attachments to the item for storage.
Use explicit built-in properties of the item such as Body to store custom data.
Add custom properties to the item using UserProperties.Add method. Note that in this case, the optional AddToFolderFields and DisplayFormat arguments of the UserProperties.Add method will be ignored.
Use the PropertyAccessor object to get or set custom properties.
For more information on storing solution data in Outlook see Storing Data for Solutions.

Unique appointment identifier in outlook when using different computers through sync'd account

Running into a slight annoyance. The application I'm developing has a calendar system built in that feeds appointments to an icloud calendar in outlook for the purpose of synchronising to phones are spread out over multiple icloud calendars (one for each person)
My problem lies in updating these appointments when changes are made on the main application. I know already that I can use AppointmentItem.GlobalAppointmentID to gain the id of the entry placed in the calendar on the computer it was created on, however I'm lead to believe this is only unique for that system (ie, another user on a different computer with the calendar synchronised would have a different set of global ID numbers)
As this number is different for each item, simply storing the GlobalAppointmentID in the database and having the application refer to that when adding/deleting/modifying an appointment wouldn't work as a reference point.
In an ideal world, I'd be using an exchange server to handle all of this, or directly modifying the appointments in icloud using c# (despite my best efforts ive been unable to find a simple method to implement this)
Am I missing something here, or is there no way to identify a unique calendar appointment entry after it has been synchronised?
Your approach is correct. GlobalAppointmentID is the proper way to obtain a global identifier for an Outlook calendar item:
The Global Object ID is the same across all copies of the item.
Detailed information on the properties related to that can be found in MS-OXOCAL.
In the case of the iCloud Control Panel, the GlobalAppointmentID will be derived from the UID iCalendar property. It should also have the raw iCalendar UID available in a separate MAPI property (you can discover such using a tool like OutlookSpy - a tool you should buy if you want to do any serious MAPI development, really).
Note that you should use the GlobalAppointmentID only for operations which are cross folder. The local identification property is the EntryID, which is like the primary key in a relational database.
P.S.: This question has some information on building a CalDAV client. Depending on what exactly you want to do, it might not be that hard - it's just an HTTP protocol with a text based payload (iCalendar).

How to remotely set multiple calendar entries of an Outlook calendar?

We have a shared excel file at work that we use as our shift planning roster, I would like to make a C# application that would query the file and depending on a selection, it would somehow send several entries/events to that particular users's outlook calendar.
I haven't had too much luck searching for how to do this, could someone please point me in the right direction? I can figure out the excel part but I have no idea how to make that work seamlessly with Outlook.
Thanks in advance :)
Use Application.CreateItem to create entries in the user's default Calendar. You can obtain their default Calendar by getting a Folder object reference from NameSpace.GetDefaultFolder.
See also: "Create an Appointment as a Meeting on the Calendar"

.ics file to save to outlook calendar automatically when the email it is attatched to is opened

I was just wondering if anyone has found of or knows a way of getting a .ics file to save to outlook calendar automatically when the email it is attatched to is opened without using the Microsoft.Office.Interop.Outlook; reference. the reason i dont want to use the outlook appointment object is because i believe it can cause problems if outlook is not already runnning.
i create the .ics file in a string builder and attatch it to a mail message but have been unable to figure out a way for it to save to the calendar when the email is opened.
i'm basically loooking for a different way of getting the same effect as Appointment.Save();
Any help would be much appreciated.
Hiky,
It cannot (and should not) be done. As Andreas points out that would be abused straight away by the unscrupulous.
If this is for a select intended audience, perhaps the way to handle it would be to provide instructions for various popular devices on how to "subscribe" to the calendar feed (not import as there is a difference)
Import a calendar
Import a ics file means that one imports the events as they are defined in the calendar file. There is no syncing or updates. One can import a set of events into an existing calendar.
Subscribe to a calendar
Subscribing means telling the calendar application the url of the calendar. It will then fetch the calendar at regular intervals, checking for updates. The calendar must be available publicly, and in Google’s case, there must be a robots.txt file that allows access for the google bot. Usually this would appear as a separate calendar in one’s calendar application, allowing one to “click” the calendar off or on.

Create IMAP account in Outlook 2007 programmatically

we're rolling out a new voicemail system, and trying to figure out a way to programmatically add a new IMAP account to a user's Outlook.
Idea is that I create a form that takes a bunch of fields needed, and creates it all for them.
I would take a look at Redemption In the commercial version there is a bonus dll "profman" Which allows you play with the outlook profiles.

Categories