Question about multiple instances of a MapiFolder object

R

reuce-google2

I have designed a MapiFolder/Folders collection wrapper class to
detect any changes in the folder structure of outlook.

Now, when I rename a folder the FolderChange event fires, sending a
MapiFolder object which has got the already new folder name. So far so
good. But inside my wrapper class there still exists a MapiFolder
object belonging to the same folder. Querying the folder name of this
object retrieves the previous name of the folder!

Is that a normal behaviour? Why doesn't the name get updated? And: Is
it still possible to use the old MapiFolder object or is not only
"outdated" in respect of the name?
 
K

Ken Slovak - [MVP - Outlook]

In cases like that you are probably best off resetting the MAPIFolder object
in your wrapper class to reflect the new item. You don't want to be holding
outdated references. You can add a public property to your wrapper class,
say called Folder and set that to the updated MAPIFolder object.
 
R

reuce-google2

In cases like that you are probably best off resetting the MAPIFolder object
in your wrapper class to reflect the new item. You don't want to be holding
outdated references. You can add a public property to your wrapper class,
say called Folder and set that to the updated MAPIFolder object.

Thanks for answering. I did as you said. But I simply was wondering
about the general approach behind that. If the wrapper class didn't
check on the FolderChange event it would never be informed about the
name change. I am quite a COM beginner and I thought the whole AddRef/
Release stuff had been devised to avoid things like that. Now I know
better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top