Appointments flash open during creation

C

Causton

Hi,

I have a program that creates many appointments into an outlook calendar.
This is done in a thread with theThread.IsBackground = true; and the
appointment display set to false, apptItem.Display(false);

When the thread runs each appointment flicks open and then closes on the
screen for each appointment creation(Very annoying). How do I stop this from
happening?

Any advice would be very greateful.

Here is the snippets



ThreadStart operation = new ThreadStart(d1.OlJobEntryAppointment);
Thread theThread = new Thread(operation);
theThread.Name = d1.Name.ToString();
theThread.IsBackground = true;
theThread.Start();


--------
public void OlJobEntryAppointment()
{
Outlook._NameSpace olNS =
Globals.ThisAddIn.Application.GetNamespace("MAPI");
Outlook.MAPIFolder olDF =

olNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.MAPIFolder olMF = olDF.Folders.GetFirst();

foreach (Job olaj in Jobs) // olaj = Outlook Appointment Job
{

DateTime jobTime = new DateTime(year, month, day, hour, minute, 0);
TimeSpan duration = new TimeSpan(1, 0, 0, 0);


Outlook._AppointmentItem apptItem =
(Outlook._AppointmentItem)olMF.Items.Add("IPM.Appointment");

apptItem.Display(false);
apptItem.Subject = olaj.jobDescription.ToString();
apptItem.Start = jobTime;
if (olaj.jobDescription.Contains("hahaha")){ apptItem.End =
jobTime.Add(duration); }
apptItem.Save();

apptItem.Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olDiscard);
}
}
}
 
B

Brian Tillman [MVP - Outlook]

I have a program that creates many appointments into an outlook calendar.
This is done in a thread with theThread.IsBackground = true; and the
appointment display set to false, apptItem.Display(false);

When the thread runs each appointment flicks open and then closes on the
screen for each appointment creation(Very annoying). How do I stop this
from
happening?

Ask programming questions in microsoft.public.outlook.program_vba or
microsoft.public.outlook.program_addins
 
Top