using (MercatorOutlook.OutlookApplication outlookApplication = new MercatorOutlook.OutlookApplication(MercatorUi.Globals.Langue))
{
if (outlookApplication == null)
return;
using (MercatorOutlook.NameSpace outlookNameSpace = outlookApplication.NameSpace)
{
if (outlookNameSpace == null)
return;
MercatorOutlook.DefaultFoldersEnum typeFolder = MercatorOutlook.DefaultFoldersEnum.FolderCalendar;
using (MercatorOutlook.Folder itemsFolder = outlookNameSpace.GetDefaultFolder(typeFolder))
{
if (itemsFolder != null)
{
using (MercatorOutlook.Item item = itemsFolder.Add())
{
item.Subject = "Test";
item.Location = "Mecalys";
item.Body = "Corps du message";
item.Start = DateTime.Now.AddHours(2);
item.End = DateTime.Now.AddHours(4);
item.MeetingStatus = MercatorOutlook.OlMeetingStatus.olMeeting;
MercatorOutlook.Recipient sentInvite1 = item.RecipientsAdd("Jean Dupont <jd@test.com>");
sentInvite1.Type = MercatorOutlook.OlMeetingRecipientType.olRequired;
MercatorOutlook.Recipient sentInvite2 = item.RecipientsAdd("Arnold Deluxe <ad@test.com>");
sentInvite2.Type = MercatorOutlook.OlMeetingRecipientType.olOptional;
item.RecipientsResolveAll();
item.Send();
item.Save();
}
}
}
}
}