"public override void ProcessItemAdd(object item)" is not working

Add-in Express™ Support Service
That's what is more important than anything else

"public override void ProcessItemAdd(object item)" is not working
"public override void ProcessItemAdd(object item)" is not working formy ,cutom folders 
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Ashish,

In that case you just need to create three instances of the events class (instead of one used in a sample add-in project) and connect them to the appropriate folders (Deleted Items).
.NET, Extended MAPI, Windows Phone & RT
Posted 06 Apr, 2011 03:01:21 Top
Ashish Sinha




Posts: 51
Joined: 2011-03-29
Hi all,


Please give me the proper solution.






Thanks,
ashish
Posted 06 Apr, 2011 06:17:43 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Ashish,

The following code works like a charm on my PC with Outlook 2010:

private OutlookItemsEventsClass1[] events;
private void AddinModule_AddinStartupComplete(object sender, EventArgs e)
{
    Outlook.NameSpace ns = OutlookApp.GetNamespace("MAPI");
    Outlook.Stores stores = ns.Stores;
    events = new OutlookItemsEventsClass1[stores.Count];
    for (int i = 0; i < stores.Count; i++)
    {
        Outlook.Store store = stores[i];
        if (store != null)
        {
             try
             {
                 Outlook.MAPIFolder folderDeletedItems = store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDeletedItems);
                 events[i] = new OutlookItemsEventsClass1(this);
                 events[i].ConnectTo(folderDeletedItems, true, true);
             }
             finally
             {
                 Marshal.ReleaseComObject(store); store = null;
             }
        }
    }
    if (stores != null)
    {
         Marshal.ReleaseComObject(stores); stores = null;
    }
    if (ns != null)
    {
         Marshal.ReleaseComObject(ns); ns = null;
    }
}



To get assistance with host applications’ objects, their properties, and methods as well as help info, use the Object Browser. Go to the VBA environment (in the host application, choose menu Tools | Macro | Visual Basic Editor or just press {Alt+F11}), press {F2}, select the host application in the topmost combo and/or specify a search string in the search combo. Select a class /property /method and press {F1} to get the help topic that relates to the object.
.NET, Extended MAPI, Windows Phone & RT
Posted 06 Apr, 2011 12:27:21 Top