Outlook MailItem Custom Fields not updating

Our company has been working on an Outlook AddIn using VSTO which has a number of issues which we have not been able to resolve yet. We have versions of the AddIn for both Outlook 2003 and Outlook 2007.
In our .NET addin we have created a couple of custom fields specific to our application on the Inbox folder. These link to user properties we create on the mail items. In code when we set the values for these user properties, we are calling mailItem.Save() both before and after to ensure the values get persisted.
We are noticing that sometimes the field value shown in the Inbox is not updating. Yet if we manually go into the mail item afterwards and save it from the GUI, it then updates properly. But closing Outlook and re-opening it or changing folders doesn't make it update. This appears to happen most often on mail items which have just been forwarded or replied to. We are unsure why the custom fields don't update sometimes and how to fix this.
 
Any help much appreciated.
timetracerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, timetracer.

Are you saying that the underlying values aren't changing or that the changes aren't reflected onscreen?
0
timetracerAuthor Commented:
The underlying values are definitely changing because if the mailItem is opened in its own window and saved again, the folder updates.

It's just not updating onscreen when we perform the save from code. Also closing and restarting Outlook doesn't fix this. You have to manually go into the individual mailitem and save from the GUI to get it to update.
0
David LeeCommented:
Does refreshing the view (i.e. pressing F5 in the explorer view) make them appear?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

timetracerAuthor Commented:
This issue is intermittent so it is difficult to test. We will undertake to do so the next time it occurs.
If it does or does not make them appear, is there anything you can think of that we could do in code to ensure that they are updated?

Thank you for your assistance.
0
David LeeCommented:
If refreshing the screen makes them appear, then you can refresh the screen from code after saving an item.  If refreshing the screen doesn't help, then we're back to square one.
0
timetracerAuthor Commented:
I have reproduced the issue, but I was unable to refresh the screen because Refresh was disabled. I think this may be because the folder is an Exchange Mailbox.

Which method can I use to refresh the screen from code? I have not seen any obvious candidates in the object model.
0
David LeeCommented:
Apologies, I lost track of this question and just now rediscovered it.  There isn't a command for refreshing the screen.  Instead, you have to simulate the pressing F5 or pulling down the View menu and selecting Refresh.  The code for simulating pressing F5 is below.  Of course if Refresh is unavailable, then it won't have any affect.
SendKeys "{F5}", True

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timetracerAuthor Commented:
Thank you for your assistance.

I will investigate further to see if this solution can help some of the people experiencing the issue, or if Refresh is unavailable on all the machines.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.