A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Problem with Calendar Items



 
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old January 5th 07, 01:45 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Problem with Calendar Items

Never delete or move items from inside a For Each ... Next type loop. The index counter gets reset each time, so you skip items. Instead use a down-counting loop.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Jynee" Jynee @discussions.microsoft.com wrote in message ...
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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are calendar items being placed in my deleted items? Dan Outlook - Calandaring 0 September 28th 06 06:59 PM
Outlook shows unread calendar items but all items are marked as re andy Outlook - Calandaring 0 August 25th 06 07:01 PM
Problem displaying mail items from within a new thread Boaz Feldbaum Add-ins for Outlook 5 June 12th 06 09:48 PM
Does anyone else have a problem with disapearing schedule items? LRP72 Outlook - General Queries 1 January 20th 06 09:04 PM
Problem with Sent Items/Redemption קובץ Outlook and VBA 10 January 12th 06 03:26 PM


All times are GMT +1. The time now is 10:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.