G
Guest
ok it's work with it :
ObjPer, ObjAppt, ObjMbx is in reference of "(e-mail address removed)"
work great.
but to make it work i am obliged to put "(e-mail address removed)" in
strAttnMandatory and strAttnOptional.
please help me :-(
// Reference to Microsoft ActiveX Data Objects 2.5 Library
// Reference to Microsoft CDO for Exchange 2000 Library
static void CreateRecurringMeeting (CDO.Person ObjPer,
CDO.Appointment ObjAppt,
CDO.CdoFrequency ObjFreq,
long LngInterval,
DateTime dtmEndDate,
CDO.IMailbox ObjMbx,
string[] strAttnMandatory,
string[] strAttnOptional)
{
try
{
// Variables.
CDO.Configuration ObjConfig = new CDO.Configuration();
CDO.IRecurrencePattern ObjRRule;
CDO.CalendarMessage ObjCalMsg;
CDO.Attendee ObjAtten = new CDO.Attendee();
ADODB.Connection ObjConn = new ADODB.Connection();
ObjConn.Provider = "ExOLEDB.DataSource";
// Set the configuration fields.
ObjConfig.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
ObjPer.Email;
ObjConfig.Fields[CDO.CdoConfiguration.cdoMailboxURL].Value =
ObjMbx.BaseFolder;
ObjConfig.Fields.Update();
ObjAppt.Configuration = ObjConfig;
// Create the RecurrencePattern object.
ObjRRule = ObjAppt.RecurrencePatterns.Add("Add");
// Set the recurrence pattern frequency,
// such as cdoWeekly or cdoDaily.
ObjRRule.Frequency = ObjFreq;
// Set the recurrence pattern interval,
// such as "2".
ObjRRule.Interval = (int)LngInterval;
// Set the recurrence pattern end date.
ObjRRule.PatternEndDate = dtmEndDate;
// Add mandatory attendees.
long i;
for (i = 0; i < strAttnMandatory.Length; ++i)
{
ObjAtten = ObjAppt.Attendees.Add("");
ObjAtten.Address = Convert.ToString(strAttnMandatory);
ObjAtten.Role = CDO.CdoAttendeeRoleValues.cdoRequiredParticipant;
}
// Add optional attendees.
for (i = 0; i < strAttnOptional.Length; ++i)
{
ObjAtten = ObjAppt.Attendees.Add("");
ObjAtten.Address = Convert.ToString(strAttnOptional);
ObjAtten.Role = CDO.CdoAttendeeRoleValues.cdoOptionalParticipant;
}
// Create the meeting request message.
ObjCalMsg = ObjAppt.CreateRequest();
// Save the appointment to the organizer's calendar.
ObjConn.Open(ObjMbx.BaseFolder, "", "", -1);
ObjAppt.DataSource.SaveToContainer(ObjMbx.Calendar, ObjConn,
ADODB.ConnectModeEnum.adModeReadWrite,
ADODB.RecordCreateOptionsEnum.adCreateNonCollection,
ADODB.RecordOpenOptionsEnum.adOpenSource, "", "");
// Send the meeting request message to the attendees.
ObjCalMsg.Message.Send();
// Close the connection.
ObjConn.Close();
Console.WriteLine("Meeting sent.");
}
catch (Exception err)
{
Console.WriteLine(err.ToString());
}
}
ObjPer, ObjAppt, ObjMbx is in reference of "(e-mail address removed)"
work great.
but to make it work i am obliged to put "(e-mail address removed)" in
strAttnMandatory and strAttnOptional.
please help me :-(
// Reference to Microsoft ActiveX Data Objects 2.5 Library
// Reference to Microsoft CDO for Exchange 2000 Library
static void CreateRecurringMeeting (CDO.Person ObjPer,
CDO.Appointment ObjAppt,
CDO.CdoFrequency ObjFreq,
long LngInterval,
DateTime dtmEndDate,
CDO.IMailbox ObjMbx,
string[] strAttnMandatory,
string[] strAttnOptional)
{
try
{
// Variables.
CDO.Configuration ObjConfig = new CDO.Configuration();
CDO.IRecurrencePattern ObjRRule;
CDO.CalendarMessage ObjCalMsg;
CDO.Attendee ObjAtten = new CDO.Attendee();
ADODB.Connection ObjConn = new ADODB.Connection();
ObjConn.Provider = "ExOLEDB.DataSource";
// Set the configuration fields.
ObjConfig.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
ObjPer.Email;
ObjConfig.Fields[CDO.CdoConfiguration.cdoMailboxURL].Value =
ObjMbx.BaseFolder;
ObjConfig.Fields.Update();
ObjAppt.Configuration = ObjConfig;
// Create the RecurrencePattern object.
ObjRRule = ObjAppt.RecurrencePatterns.Add("Add");
// Set the recurrence pattern frequency,
// such as cdoWeekly or cdoDaily.
ObjRRule.Frequency = ObjFreq;
// Set the recurrence pattern interval,
// such as "2".
ObjRRule.Interval = (int)LngInterval;
// Set the recurrence pattern end date.
ObjRRule.PatternEndDate = dtmEndDate;
// Add mandatory attendees.
long i;
for (i = 0; i < strAttnMandatory.Length; ++i)
{
ObjAtten = ObjAppt.Attendees.Add("");
ObjAtten.Address = Convert.ToString(strAttnMandatory);
ObjAtten.Role = CDO.CdoAttendeeRoleValues.cdoRequiredParticipant;
}
// Add optional attendees.
for (i = 0; i < strAttnOptional.Length; ++i)
{
ObjAtten = ObjAppt.Attendees.Add("");
ObjAtten.Address = Convert.ToString(strAttnOptional);
ObjAtten.Role = CDO.CdoAttendeeRoleValues.cdoOptionalParticipant;
}
// Create the meeting request message.
ObjCalMsg = ObjAppt.CreateRequest();
// Save the appointment to the organizer's calendar.
ObjConn.Open(ObjMbx.BaseFolder, "", "", -1);
ObjAppt.DataSource.SaveToContainer(ObjMbx.Calendar, ObjConn,
ADODB.ConnectModeEnum.adModeReadWrite,
ADODB.RecordCreateOptionsEnum.adCreateNonCollection,
ADODB.RecordOpenOptionsEnum.adOpenSource, "", "");
// Send the meeting request message to the attendees.
ObjCalMsg.Message.Send();
// Close the connection.
ObjConn.Close();
Console.WriteLine("Meeting sent.");
}
catch (Exception err)
{
Console.WriteLine(err.ToString());
}
}