如何使用Redemption.dll将联系人添加到日历中?使用C#

时间:2009-11-02 10:31:27

标签: c# outlook

我正在使用以下代码:

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();

但是上面的代码没有在Caledar中添加联系人。

任何人都可以帮助我。

此致

Saggy

2 个答案:

答案 0 :(得分:0)

你使用救赎的事实不应该有所作为:
使用AppointmentItem.Recipients.Add()添加收件人 要将它们设置为可选或必需(默认),请将收件人类型设置为olRequiredolOptional(请参阅Outlook宏编辑器中对象浏览器中的OlMeetingRecipientType)。

示例:
Recipients.Item(1).Type = olRequired
Recipients.Add("foo@bar.com").Type = olOptional

答案 1 :(得分:0)

这是我目前用于安排约会的代码:

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;