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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

BeforeFolderMove Event



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 19th 08, 10:58 AM posted to microsoft.public.outlook.program_addins
Juuso
external usenet poster
 
Posts: 3
Default BeforeFolderMove Event

Hi,

I'm using VS2008 & Outlook 2007. My application tries to watch Outlook
folders, their additions, renames, moves and deletions.

I have a wrapper class for a folder that has class level variables for
folder (Outlook.Folder) and it's subfolders (Outlook.Folders). When this
class is initialized, these variables are set and events attached (see below
my code). In ThisAddin_Startup "watched" folder and it's subfolders are
iterated, wrapper classes created and added to a class level hashtable.

The problem is, BeforeFolderMove for a folder in my wrapper class fires only
occasionally, but folder addition and change always do. This shouldn't be a
scope issue, as the two other events do fire. Or what's happening?

Thanks for any help.

....
private Outlook.Folders _folders;
private Outlook.Folder _folder;

public DFolder(Outlook.MAPIFolder folder)
{
// Set folder variables
_folder = folder as Outlook.Folder;
_folders = folder.Folders;

// Setup events
_folder.BeforeFolderMove += new
Outlook.MAPIFolderEvents_12_BeforeFolderMoveEventH andler(folder_BeforeFolderMove);
_folders.FolderChange += new
Outlook.FoldersEvents_FolderChangeEventHandler(fol der_FolderChange);
_folders.FolderAdd += new
Outlook.FoldersEvents_FolderAddEventHandler(folder _FolderAdd);
}

Ads
  #2  
Old September 19th 08, 06:25 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default BeforeFolderMove Event

_folder and _folders variables must be declared on the class level. In your
case they are local variables; as soon as the GC releases them, no events
will be fired.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi,

I'm using VS2008 & Outlook 2007. My application tries to watch Outlook
folders, their additions, renames, moves and deletions.

I have a wrapper class for a folder that has class level variables for
folder (Outlook.Folder) and it's subfolders (Outlook.Folders). When this
class is initialized, these variables are set and events attached (see
below
my code). In ThisAddin_Startup "watched" folder and it's subfolders are
iterated, wrapper classes created and added to a class level hashtable.

The problem is, BeforeFolderMove for a folder in my wrapper class fires
only
occasionally, but folder addition and change always do. This shouldn't be
a
scope issue, as the two other events do fire. Or what's happening?

Thanks for any help.

...
private Outlook.Folders _folders;
private Outlook.Folder _folder;

public DFolder(Outlook.MAPIFolder folder)
{
// Set folder variables
_folder = folder as Outlook.Folder;
_folders = folder.Folders;

// Setup events
_folder.BeforeFolderMove += new
Outlook.MAPIFolderEvents_12_BeforeFolderMoveEventH andler(folder_BeforeFolderMove);
_folders.FolderChange += new
Outlook.FoldersEvents_FolderChangeEventHandler(fol der_FolderChange);
_folders.FolderAdd += new
Outlook.FoldersEvents_FolderAddEventHandler(folder _FolderAdd);
}



  #3  
Old September 19th 08, 07:03 PM posted to microsoft.public.outlook.program_addins
Juuso
external usenet poster
 
Posts: 3
Default BeforeFolderMove Event

Hi Dmitry,

those variables are on the class level and FolderChange and FolderAdd events
do always fire. The problem is only with the BeforeFolderMove event, that
might or might not fire.


"Dmitry Streblechenko" wrote:

_folder and _folders variables must be declared on the class level. In your
case they are local variables; as soon as the GC releases them, no events
will be fired.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi,

I'm using VS2008 & Outlook 2007. My application tries to watch Outlook
folders, their additions, renames, moves and deletions.

I have a wrapper class for a folder that has class level variables for
folder (Outlook.Folder) and it's subfolders (Outlook.Folders). When this
class is initialized, these variables are set and events attached (see
below
my code). In ThisAddin_Startup "watched" folder and it's subfolders are
iterated, wrapper classes created and added to a class level hashtable.

The problem is, BeforeFolderMove for a folder in my wrapper class fires
only
occasionally, but folder addition and change always do. This shouldn't be
a
scope issue, as the two other events do fire. Or what's happening?

Thanks for any help.

...
private Outlook.Folders _folders;
private Outlook.Folder _folder;

public DFolder(Outlook.MAPIFolder folder)
{
// Set folder variables
_folder = folder as Outlook.Folder;
_folders = folder.Folders;

// Setup events
_folder.BeforeFolderMove += new
Outlook.MAPIFolderEvents_12_BeforeFolderMoveEventH andler(folder_BeforeFolderMove);
_folders.FolderChange += new
Outlook.FoldersEvents_FolderChangeEventHandler(fol der_FolderChange);
_folders.FolderAdd += new
Outlook.FoldersEvents_FolderAddEventHandler(folder _FolderAdd);
}




  #4  
Old September 19th 08, 10:30 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default BeforeFolderMove Event

Oops, sorry, I don't know where I was looking :-)
I have heard of problems with BeforeFolderMove (which I personally do not
use) - BeforeFolderMove, unlike FolderChange and FolderAdd events, is a pure
UI event and has no MAPI counterpart. I bet not all codepaths in Outlook
call that event.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi Dmitry,

those variables are on the class level and FolderChange and FolderAdd
events
do always fire. The problem is only with the BeforeFolderMove event, that
might or might not fire.


"Dmitry Streblechenko" wrote:

_folder and _folders variables must be declared on the class level. In
your
case they are local variables; as soon as the GC releases them, no events
will be fired.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi,

I'm using VS2008 & Outlook 2007. My application tries to watch Outlook
folders, their additions, renames, moves and deletions.

I have a wrapper class for a folder that has class level variables for
folder (Outlook.Folder) and it's subfolders (Outlook.Folders). When
this
class is initialized, these variables are set and events attached (see
below
my code). In ThisAddin_Startup "watched" folder and it's subfolders are
iterated, wrapper classes created and added to a class level hashtable.

The problem is, BeforeFolderMove for a folder in my wrapper class fires
only
occasionally, but folder addition and change always do. This shouldn't
be
a
scope issue, as the two other events do fire. Or what's happening?

Thanks for any help.

...
private Outlook.Folders _folders;
private Outlook.Folder _folder;

public DFolder(Outlook.MAPIFolder folder)
{
// Set folder variables
_folder = folder as Outlook.Folder;
_folders = folder.Folders;

// Setup events
_folder.BeforeFolderMove += new
Outlook.MAPIFolderEvents_12_BeforeFolderMoveEventH andler(folder_BeforeFolderMove);
_folders.FolderChange += new
Outlook.FoldersEvents_FolderChangeEventHandler(fol der_FolderChange);
_folders.FolderAdd += new
Outlook.FoldersEvents_FolderAddEventHandler(folder _FolderAdd);
}






  #5  
Old September 20th 08, 10:27 AM posted to microsoft.public.outlook.program_addins
Juuso
external usenet poster
 
Posts: 3
Default BeforeFolderMove Event

Maybe it has something to do with Outlook's internal GC? If I setup a
"watched" folder with BeforeFolderMove event and cancel parameter set to
true, and then trying hit the delete, a few times the event is fired and the
folder is not removed. However, after a while (after GC?) the folder will be
removed because BeforeFolderMove didn't fire.

Fortunately I can use Redemption events for what I need

Thanks!


"Dmitry Streblechenko" wrote:

Oops, sorry, I don't know where I was looking :-)
I have heard of problems with BeforeFolderMove (which I personally do not
use) - BeforeFolderMove, unlike FolderChange and FolderAdd events, is a pure
UI event and has no MAPI counterpart. I bet not all codepaths in Outlook
call that event.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi Dmitry,

those variables are on the class level and FolderChange and FolderAdd
events
do always fire. The problem is only with the BeforeFolderMove event, that
might or might not fire.


"Dmitry Streblechenko" wrote:

_folder and _folders variables must be declared on the class level. In
your
case they are local variables; as soon as the GC releases them, no events
will be fired.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi,

I'm using VS2008 & Outlook 2007. My application tries to watch Outlook
folders, their additions, renames, moves and deletions.

I have a wrapper class for a folder that has class level variables for
folder (Outlook.Folder) and it's subfolders (Outlook.Folders). When
this
class is initialized, these variables are set and events attached (see
below
my code). In ThisAddin_Startup "watched" folder and it's subfolders are
iterated, wrapper classes created and added to a class level hashtable.

The problem is, BeforeFolderMove for a folder in my wrapper class fires
only
occasionally, but folder addition and change always do. This shouldn't
be
a
scope issue, as the two other events do fire. Or what's happening?

Thanks for any help.

...
private Outlook.Folders _folders;
private Outlook.Folder _folder;

public DFolder(Outlook.MAPIFolder folder)
{
// Set folder variables
_folder = folder as Outlook.Folder;
_folders = folder.Folders;

// Setup events
_folder.BeforeFolderMove += new
Outlook.MAPIFolderEvents_12_BeforeFolderMoveEventH andler(folder_BeforeFolderMove);
_folders.FolderChange += new
Outlook.FoldersEvents_FolderChangeEventHandler(fol der_FolderChange);
_folders.FolderAdd += new
Outlook.FoldersEvents_FolderAddEventHandler(folder _FolderAdd);
}







  #6  
Old September 24th 08, 01:02 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default BeforeFolderMove Event

Hard to say.. Are o usur your obejcts do not get released?
Keep in mind that Redemption won't help you with BeforeFolderMove -
Redemption wraps MAPI events, which firte asynchonously after the action
takes place. BeforeFolderMove is fired by Outlook *before* the folder is
deleted.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
news
Maybe it has something to do with Outlook's internal GC? If I setup a
"watched" folder with BeforeFolderMove event and cancel parameter set to
true, and then trying hit the delete, a few times the event is fired and
the
folder is not removed. However, after a while (after GC?) the folder will
be
removed because BeforeFolderMove didn't fire.

Fortunately I can use Redemption events for what I need

Thanks!


"Dmitry Streblechenko" wrote:

Oops, sorry, I don't know where I was looking :-)
I have heard of problems with BeforeFolderMove (which I personally do
not
use) - BeforeFolderMove, unlike FolderChange and FolderAdd events, is a
pure
UI event and has no MAPI counterpart. I bet not all codepaths in Outlook
call that event.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi Dmitry,

those variables are on the class level and FolderChange and FolderAdd
events
do always fire. The problem is only with the BeforeFolderMove event,
that
might or might not fire.


"Dmitry Streblechenko" wrote:

_folder and _folders variables must be declared on the class level. In
your
case they are local variables; as soon as the GC releases them, no
events
will be fired.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Juuso" wrote in message
...
Hi,

I'm using VS2008 & Outlook 2007. My application tries to watch
Outlook
folders, their additions, renames, moves and deletions.

I have a wrapper class for a folder that has class level variables
for
folder (Outlook.Folder) and it's subfolders (Outlook.Folders). When
this
class is initialized, these variables are set and events attached
(see
below
my code). In ThisAddin_Startup "watched" folder and it's subfolders
are
iterated, wrapper classes created and added to a class level
hashtable.

The problem is, BeforeFolderMove for a folder in my wrapper class
fires
only
occasionally, but folder addition and change always do. This
shouldn't
be
a
scope issue, as the two other events do fire. Or what's happening?

Thanks for any help.

...
private Outlook.Folders _folders;
private Outlook.Folder _folder;

public DFolder(Outlook.MAPIFolder folder)
{
// Set folder variables
_folder = folder as Outlook.Folder;
_folders = folder.Folders;

// Setup events
_folder.BeforeFolderMove += new
Outlook.MAPIFolderEvents_12_BeforeFolderMoveEventH andler(folder_BeforeFolderMove);
_folders.FolderChange += new
Outlook.FoldersEvents_FolderChangeEventHandler(fol der_FolderChange);
_folders.FolderAdd += new
Outlook.FoldersEvents_FolderAddEventHandler(folder _FolderAdd);
}









 




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
Event loop when saving Task item in event handler Mustafa Add-ins for Outlook 1 August 8th 08 06:24 PM
How do I stop an event from changing to recurring event automatica WON Outlook - Calandaring 1 March 2nd 08 09:42 PM
Problem with CommandBarComboBox Change Event (Event fires only once) M. Khalid Farooq Add-ins for Outlook 1 October 19th 06 02:34 PM
getting calendar event reminder for deleted event [email protected] Outlook - General Queries 3 September 4th 06 02:11 PM
can a calander event to automaticaly reply during the event? How DG at uei Outlook - Calandaring 1 April 28th 06 07:45 AM


All times are GMT +1. The time now is 08:24 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.