The second issue is easy, you have the same Tag property for both buttons so
a click in one will fire in both. The solution is to make each Tag value
unique. What I usually do is keep a running counter of all Explorers and
Inspectors that are opened in an Outlook session. Each time one opens I
increment the counter and apply that value as a Key property in my wrapper
class. When I construct the Tag it would be constructed like this:
const string buttonTag = "InspectorApplyButton";
string tag = buttonTag + (string)this.Key;
button.Tag = tag;
As far as the first issue, before I start reviewing the code, does the view
work correctly and maintain the displayed values if it's applied to folders
in a POP3 PST file or an Exchange mailbox and not a folder related to IMAP?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message
ps.com...
Thanks for your attention Ken.
Right now I can't seem to reproduce the problem with the folders.. It
was consistent earlier today. So let's forget about that issue for
now.
About my custom view:
I install it the first time the user starts Outlook with the add-in,
on all the folders.
Outlook.View MyView = inbox.Views.Add("My custom view",
Outlook.OlViewType.olTableView,
Outlook.OlViewSaveOption.olViewSaveOptionalAllFold ersOfType);
System.IO.TextReader ViewFile = File.OpenText(sViewFile);
string sXMLText = ViewFile.ReadToEnd();
Translate the string to appropriate language....
MyView.XML = sXMLText;
MyView.Save();
MyView.Apply();
Every time a folder is selected, I force on the view, because I have
experienced that the view sometimes dissapears.
Outlook.View MyView = selectedFolder.Views["My custom view"];
MyView.Apply();
I have also experienced that the view get destroyed. It says the
current view is "My custom view", but the columns indicate that it is
the standard Message IMAP view. To fix it I have to remove the view
and install it all over. To do that I have made an option pane with a
button that says Reset View, which installs the view on the selected
folder. After installing it on the separate folder it seems to stay as
it should forever.
Now.. as you have noticed, the view is defined in a xml file.
I do not have the received date defined as a column, and i suspect
that have something to do with the odd behaviour of the group by
funtionalitity.
However, I have defined in the file that the view shall be ordered by
the datereceived property.
groupbydefault-tag says 2, but I really dont know what that means.
Have tried to set it to 1 and 0, but it didn't seem to matter.
I find it strange that the sorting is functioning as it should when I
manually set it to sort on date, and that it just says Date: None when
I switch back to the folder.
While we're at it.. another issue just appeared.
I got this button on my message form, which is located next to Send
and Print.. in the command button row.. which I call Accept.
Now, if I open one message and press the Accept-button, the message is
accepted on the server (using a separate connection, not IMAP).
But when I open two messages simultaniously, both messages get
accepted when I press the button on one of them.
I've got a mailitem wrapper which initiate an event when we open a
mailitem. What I don't understand is why this event get fired on both
the mailitems. They both have accept-buttons, they both have event to
handle these buttons, but they got separate wrappers which initiates
these. Seems like the event I add on a button gets confused.. as if it
is connected to the name of the button, and not the button itself.
The mailitem wrapper is created in the OnNewInspector handler.
Any suggestions on what to look for would be appreciated.