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

MapiFolder Items ItemChange is not firing



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 5th 06, 01:36 PM posted to microsoft.public.outlook.program_forms
AtulSureka
external usenet poster
 
Posts: 11
Default MapiFolder Items ItemChange is not firing

Hi,

I have used the following code to Handle the EditItem Event of Task Items

using System;
using System.Data;
using System.Collections;
using Outlook = Microsoft.Office.Interop.Outlook;

public class MyClass
{
private static Outlook.NameSpace nSpace;
private static Outlook.MAPIFolder mapiFolder;

public static void Main(string[] args)
{
Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
nSpace = app.GetNamespace("MAPI");

mapiFolder =
nSpace.GetDefaultFolder(Outlook.OlDefaultFolders.o lFolderTasks);
mapiFolder.Items.ItemChange += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemC hangeEventHandler(TaskItemChanged);

Console.ReadLine();
}

private static void TaskItemChanged(object Item)
{
Console.WriteLine("Item Has been chnaged");
}
}

However many times ItemChange event does not fire.
What can be the possible reasons?
Is there any work around for it?

- Atul Sureka

Ads
  #2  
Old February 6th 06, 05:32 PM posted to microsoft.public.outlook.program_forms
Thaddaeus Parker
external usenet poster
 
Posts: 17
Default MapiFolder Items ItemChange is not firing

One way I found to get around this is to have the Explorer.SelectionChange
event add the Items_Change event for the folder. The problem with the
selection change event is that it gets fired each and every time you gain
focus on a separate view,folder, item, etc. Here is the sample code that I
used.

static int itemChangeEventCount = 0;

private void currentExplorer_SelectionChange()

{

if(string.Compare(currentExplorer.CurrentFolder.Na me,taskItemsFolderCollection.Name,
true) == 0)

{

//we are tracking changes to the taskItemsFolderCollection

Trace.WriteLine("We had a selection change");

Trace.WriteLine("we are tracking any changes to the task Items");

if(itemChangeEventCount 1)

{

taskItemsFolderCollection.Items.ItemChange += new
ItemsEvents_ItemChangeEventHandler(Items_ItemChang e);

itemChangeEventCount++;

}}}
if you don't make a check to see whether or not you are in the right folder
during the selection change you end up with A LOT of events firing when they
shouldn't.

Regards,

Thaddaeus.
"AtulSureka" wrote in message
...
Hi,

I have used the following code to Handle the EditItem Event of Task Items

using System;
using System.Data;
using System.Collections;
using Outlook = Microsoft.Office.Interop.Outlook;

public class MyClass
{
private static Outlook.NameSpace nSpace;
private static Outlook.MAPIFolder mapiFolder;

public static void Main(string[] args)
{
Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
nSpace = app.GetNamespace("MAPI");

mapiFolder =
nSpace.GetDefaultFolder(Outlook.OlDefaultFolders.o lFolderTasks);
mapiFolder.Items.ItemChange += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemC hangeEventHandler(TaskItemChanged);

Console.ReadLine();
}

private static void TaskItemChanged(object Item)
{
Console.WriteLine("Item Has been chnaged");
}
}

However many times ItemChange event does not fire.
What can be the possible reasons?
Is there any work around for it?

- Atul Sureka



 




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
tentative items Daniel Outlook - Calandaring 2 February 20th 06 04:07 PM
Inbox, Sent Items & Outbox in Deleted Items in Outlook 2003 & OWA with Exchange splounx Outlook - General Queries 1 February 17th 06 03:22 AM
Delete items from sent items box Selector007 Outlook - General Queries 1 February 13th 06 10:47 PM
How to hide Read items? I want to see only the Unread Items in my view. [email protected] Outlook - General Queries 3 February 7th 06 03:56 PM
How do I get sent items to be shown in my sent items folder? Sue B Outlook - General Queries 8 January 28th 06 08:46 PM


All times are GMT +1. The time now is 06:18 PM.


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.