View Single Post
  #1  
Old January 5th 07, 09:38 AM posted to microsoft.public.outlook.program_forms
Jynee
external usenet poster
 
Posts: 1
Default Problem with Calendar Items

Greetings,

In the Calendar folder, I add three appointment items as following in
sequence:
1. Start time: 9am Subject: Out to breakfast
2. Start time: 10am Subject: Out to meeting
3. Start time: 11am Subject: Out to lunch

I create an addin to check for the items in the calendar and integrate it
with a voicemail program. The problem I face is when I deleted the first
appointment scheduled at 9am, the event at 11am will never be noticed. The
code I used to check the items in Calendar folder is as below (I had cut out
the code which is unrelated due to lengthy issue):

private Outlook.NameSpace myNS;
private Outlook.Items myItems;
private Outlook.MAPIFolder myFolder;

myNS = applicationObject.GetNamespace("MAPI");
myFolder = myNS.GetDefaultFolder(Outlook.OlDefaultFolders.olF olderCalendar);
myItems = myFolder.Items;

for (intLoopCounter = 1; intLoopCounter = myItems.Count; intLoopCounter++)
{
// do something here
}

By the way, after I deleted the first event at 9am, I try to get the start
time by using a MessageBox. I get two items listed which is the first at
9am(althought first appointment should be already being deleted) the second
events at 10am. The third event at 11am is not listed although the third
events at 11am is still listed in the Calendar folder.

After that, the first event at 9am which is being deleted from Calendar
folder is again deleted from DeletedItem folder. I get an exception as below:

unable to cast COM object of type 'System.__ComObject' to interface type
Microsoft.Office.Interop.Outlook.AppointmentItem'. This operation failed
because the QueryInterface call on the COM component for the interface with
IID failed due to the following error: No such interface supported(Exception
from HRESULT: 0x80004002(E_NOINTERFACE))

Hope some experts out there can give me some advice in solving this problem.

Thanks in advance and have a nice day
Ads