Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
206 stars 56 forks source link

Open Appointment in Specific Folder/Set Folder within MsgKit #93

Closed KeesBL closed 1 year ago

KeesBL commented 1 year ago

I've created an appointment in MsgKit with Process.Start and I am trying to send it. Populating properties works well, and the message is well formatted when it opens in Outlook. However, I am unable to send it from outlook: I get a msgbox with the error message "Cannot send this meeting request."

Setting the folder is the only part of my previous code I was unable to replicate in MsgKit. Previously, I created the appointment item in a shared folder using the following code:

var recipient = mapi.CreateRecipient("norpy@contoso.com");
recipient.Resolve();
var folder = mapi.GetSharedDefaultFolder(recipient, OlDefaultFolders.olFolderCalendar);
var olAppointment = (AppointmentItem)folder.Items.Add(OlItemType.olAppointmentItem);

Is there a way to set the folder during the creation of the .msg file, or is that something that needs to be handled via Outlook?

Thanks in advance!

Sicos1977 commented 1 year ago

To be honest I have no idea, normally a folder is not part of a msg file because the "folder" in Outlook is the place where you store an msg file. I have to look into the msg specifications to see if something like this is possible.