Creat a reccuring appointment

O

othmane benchebab

I have create an reccuring appointment but when i have a problem with :

myPattern.RecurrenceType = Microsoft.Office.Interop.Outlook.OlRecurrenceType.olRecursWe ekly;
myPattern.DayOfWeekMask = Microsoft.Office.Interop.Outlook.OlDaysOfWeek.olMonday;

that's work , but i can't put more than one day.

i have find that everyday have a value :

olSunday = 1,
olMonday = 2,
olTuesday = 4,
olWednesday = 8,
olThursday = 16,
olFriday = 32,
olSaturday = 64


when ,for exemple, i put sunday and monday my DayOfWeekMask value is 3.
but i can't do : myPattern.DayOfWeekMask=3;

have u any explication please??
 
O

othmane benchebab

i find a solution :


myPattern.RecurrenceType = Microsoft.Office.Interop.Outlook.OlRecurrenceType.olRecursWe ekly;
string nomsdesjours = _rdvPeriod.NomJourSemaine;
char[] splitter = { ';' };

string[] Vecteur_jours = nomsdesjours.Split(splitter);
Microsoft.Office.Interop.Outlook.OlDaysOfWeek JourDeSemaineMask = GetDayOfWeek(Vecteur_jours[0]);
foreach (string jour in Vecteur_jours)
{
JourDeSemaineMask = JourDeSemaineMask | GetDayOfWeek(jour);
}
myPattern.DayOfWeekMask = JourDeSemaineMask ;
 
K

Ken Slovak - [MVP - Outlook]

It works here if I Or the values I want:

myPattern.DayOfWeekMask = OlDaysOfWeek.olSunday | OlDaysOfWeek.olMonday;

What interval are you setting?

The VBA code in the Help for setting the recurrence pattern also works
(modified a little to work as an Outlook VBA macro):

Sub CreateAppointment()
Dim myOlApp As Outlook.Application
Dim myApptItem As AppointmentItem
Dim myRecurrPatt As RecurrencePattern
Set myOlApp = Application
Set myApptItem = myOlApp.CreateItem(olAppointmentItem)
Set myRecurrPatt = myApptItem.getrecurrencepattern

myRecurrPatt.RecurrenceType = olRecursWeekly
myRecurrPatt.DayOfWeekMask = olMonday Or olSunday
myRecurrPatt.PatternStartDate = #1/21/2008 2:00:00 PM#
myRecurrPatt.Interval = 1
myRecurrPatt.PatternEndDate = #12/21/2008 5:00:00 PM#
myApptItem.Subject = "Important Appointment"
myApptItem.Save
myApptItem.Display

End Sub
 
O

othmane benchebab

thanks
but i get the name of days from a list of chekbox
like un outlook.and after i put the name of days in my _rdvPeriod.NomJourSemaine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top