Rename IMAP folder and Custom View Group by

J

jorgen.slettahjell

I am currently developing an add-in in c# for Outlook 2003 and have
encountered a couple of issues. I believe they are not directly
connected to the add-in, but I have seen some strange things happen
before....

Connected to the server, the user might want to rename his IMAP
folders. Most of the folders are not supposed to be renamed from the
client, and these restrictions have been set on the server.
So when the client tries to rename a folder, the client asks the
server if it is ok, and the server returns with the result and the
folder is not renamed. The problem appears if the user tries to rename
the same folder twice in a row. The second time the client (Outlook)
does NOT send a request to the server and instead it shuts the
connection down and all functionality just stops working.
Is there ANYTHING I can do with my add-in to fix this issue? Or
anything I can do anywhere else? My users are definitely not happy
about this bug.

My second problem is similar, something I don't see I can fix with my
add-in, but perhaps MIGHT be fixed with my add-in after all..
I got a default view on my folders, with a lot of custom fields to
show to the user.
The default behavior is to use ... and arrange the view by Date. Now,
if I right click on a column and set it the view to be arranged by
date, it works as it should. The view is group up and shows Today,
Yesterday etc. This is fine as long as I stay in this folder. If I
switch to another folder and back, the view is still group by Date,
but instead of the actual days and dates it says "Date: None" in every
bracket. By default, it always says None until I actively sets the
grouping.

Any suggestions?
 
J

jorgen.slettahjell

Oops.. a little typing error..
"The default behaviour is to use ..." - the dots means "Arrange By-
 
K

Ken Slovak - [MVP - Outlook]

Does the problem with IMAP happen if your addin isn't installed or running?
If not what is your code doing, are any exceptions being fired from your
code?

For the view, how are you creating it and how are you setting it in the
folder?
 
J

jorgen.slettahjell

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.olViewSaveOptionalAllFoldersOfType);
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.
 
K

Ken Slovak - [MVP - Outlook]

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?




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.olViewSaveOptionalAllFoldersOfType);
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.
 
G

Guest

I am having a similar problem with the received date showing up as "None".
We use an IMAP server and this problem is only showing up for one of our
users as far as I know. This makes it difficult for him to keep up with his
emails because he receives nearly 100 per day. He was using POP before and
never had a problem. I don't know if it is an IMAP/Outlook problem or the
fact that he has several thousand emails stored in various folders in his
IMAP account. Either way I am needing help finding a solution.
 

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

Similar Threads

IMAP 1
IMAP 0
Outlook View Control Folder property 2
Custom Folder Icon 1
IMAP only client 3
Create custom public folders in Exchange 2003 2
Adding icon to custom view 4
Folder Custom View 6

Top