Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / June 2005

Tip: Looking for answers? Try searching our database.

Detect FolderChange, FolderDelete and FolderAdd

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
semut - 08 Jun 2005 10:57 GMT
Hello,

   What is the recommended and effective way to detect any  FolderChange,
FolderDelete and FolderAdd event in OUtlook. That include when user right
click on a folder and through context menu, add new folder, or delete or
rename a folder.

   Is it event sink all availble MAPIFolder's folders collections when
first started Outlook and add more event sink when there are new MAPIFolder
added, unadvise related event sink when MAPIFolder remove.

   Then, later when exit Outlook,  unadvise all one by one. (all the
MAPIFolder).

   Please advise.

thanks.
Dmitry Streblechenko - 08 Jun 2005 18:23 GMT
What exactly (and why) are you trying to do?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> Hello,
>
[quoted text clipped - 13 lines]
>
> thanks.
semut - 09 Jun 2005 03:03 GMT
I am trying to catch any FolderChange, FolderDelete and FolderAdd occur in
Outlook.

The current event model of OOM is that I need to sink each folder collection
I am interested. The solution that I have is to advice and unadvice the
MAPIFolder OnBeforeFolderChange but that only working on the Items Event and
not to FolderEvent cause user can add/remove/rename folder through context
menu.  I trying to come out with a proper workaround for this. Any better
approach??

thanks

> What exactly (and why) are you trying to do?
>
[quoted text clipped - 20 lines]
>>
>> thanks.
Dmitry Streblechenko - 09 Jun 2005 18:20 GMT
*WHY* are you trying to do this?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

>I am trying to catch any FolderChange, FolderDelete and FolderAdd occur in
>Outlook.
[quoted text clipped - 32 lines]
>>>
>>> thanks.
Mark Werner - 09 Jun 2005 23:46 GMT
You need to sink off of the explorer events. For example folder change is
event 0xf003 in the explorer events.
semut - 10 Jun 2005 03:08 GMT
Thank you for your reply,
The 0xf003 is for event ExplorerEvent::BeforeFolderSwitch which I already
did for the attempt to detect the folder switch and sink on and off. The
problem is that it can't detect the context menu (right click)  function
like rename, delete and add when user right click on a folder, the sink
off/on for Folder collection is not accurate when user choose to use context
menu to do rename, add and remove folder.
The context menu click is non detectable by Outlook OOM event sink as far as
I know. Any workaround?

> You need to sink off of the explorer events. For example folder change is
> event 0xf003 in the explorer events.
semut - 10 Jun 2005 03:22 GMT
the 0xf003 is event for ExplorerEvent::BeforeFolderSwitch which I already
did.

The problem is that it can't detect context menu click on function like
Folder Add, Folder rename and
folder delete.

Any workaround?

> You need to sink off of the explorer events. For example folder change is
> event 0xf003 in the explorer events.
Mark Werner - 10 Jun 2005 16:42 GMT
I just added an event sink (folder add) for my inbox folder and used the
context menu to add a folder to my inbox folder. It caught the event no
problem. Are you sure you sinked to the folder that you right clicked on?
semut - 13 Jun 2005 03:23 GMT
Yup, the event sink could detect. My problem is to set up the event sink to
that particular folder. I need something dynamic. I am using
BeforeFolderSwitch at the moment.

My initial problem
------------------------
I need to detect any folder add event occur in Outlook. (in any folder
collection).

>I just added an event sink (folder add) for my inbox folder and used the
> context menu to add a folder to my inbox folder. It caught the event no
> problem. Are you sure you sinked to the folder that you right clicked on?
Mark Werner - 13 Jun 2005 06:04 GMT
What language? I have an ATL class that allows dynamic folder event sinks.
semut - 14 Jun 2005 03:48 GMT
Probably I should make it clearer.

I could dynamically folder event sink, the classes are available in ATL I
know . And the Outlook could detect the folder event (although,
FolderDeletion could not detect the last folder deletion in a Folder
collection, but that could be overcome with some algorithm) . The problem is
that I  could not accurately determine "when" should dynamically event sink
for the needed folder collection.

As you know, the befoforefolderswitch (which is the time to dynamically
event sink) only occur if user open the folder, that is by left clicking a
folder. If user choose to right click on a folder and through context menu
do some folder stuff. There is no way to determine if the user is clicking
on that particular folder. Therefore, the dynamic event sink approach could
not be a right approach to achieve what I want, to detect any folder
collection happen in Outlook.

The CommandBarUpdate could detect the user right click but after some test,
to my dissapointment, the event happen in an inconsistent manner.

The ultimate approach that I could think of is to event sink all the folder
collections in the Outlook and when there are Folder added/ remove. Then,
the corresponding new folder collection will get event sink / unadvice.

The only problem of me to this is the overhead it might cause,  imagine
there are many folders in Outlook.

Anyway, thanks for your reply.

> What language? I have an ATL class that allows dynamic folder event sinks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.