How to add contacts into Calendar using Redemption.dll ? using C#
I am using below code:
Redemption.RDOAppointmentItem objAppointment;开发者_如何学运维
Redemption.RDORecurrencePattern objRecurrence;
objAppointment = (Redemption.RDOAppointmentItem)p_objDestFolder.Items.Add( p_objDestFolder.DefaultItemType);
objAppointment.OptionalAttendees = "Contact@yahoo.com";
objAppointment.RequiredAttendees = "Contact@stack.com;
objAppointment.Save();
But above code not adding contact into Caledar.
Can anyone help me out in it.
Regards,
Saggy
This is the code I am currently using to schedule an appointment:
RDOSession session = new RDOSession();
session.Logon(System.Reflection.Missing.Value, System.Reflection.Missing.Value, false, true, System.Reflection.Missing.Value, false);
RDOFolder calendar = session.GetDefaultFolder(rdoDefaultFolders.olFolderCalendar);
RDOAppointmentItem oAppointment = (RDOAppointmentItem)calendar.Items.Add(rdoItemType.olAppointmentItem);
oAppointment.Subject = "This is a test subject";
oAppointment.Body = "This is a test body";
oAppointment.Start = DateTime.Now;
oAppointment.End = DateTime.Now.AddMinutes(15);
oAppointment.ReminderSet = true;
oAppointment.ReminderMinutesBeforeStart = 30;
oAppointment.Importance = (int)rdoImportance.olImportanceNormal;
oAppointment.BusyStatus = rdoBusyStatus.olBusy;
oAppointment.Save();
oAppointment = null;
calendar = null;
session.Logoff();
session = null;
The fact that you are using Redemption should not make a difference:
Use AppointmentItem.Recipients.Add()
to add recipients.
To set them as optional or required (default) set the recipient type to olRequired
or olOptional
(see OlMeetingRecipientType
in the Object Browser in Outlooks Macro Editor).
Examples:
Recipients.Item(1).Type = olRequired
Recipients.Add("foo@bar.com").Type = olOptional
精彩评论