简体   繁体   中英

Outlook: How to refresh folder after setting “Categories” on mails

I wrote some code to parse the subjects of mails in a certain folder. The parsed stuff gets written to the Categories -field of the mail-object. According to debugging this works nicely.

The problem now is that I do not see the effect in Outlook. Actually I only see it in five out of ~30 mails. On those five the Categories -column and the output in the mail panel present the correct value. All other mails show nothing in those two areas.

Clicking on each mail, going to another folder and then back, double-clicking a mail don't do anything.

What do I need to do to update the folder to see the categories on all mails?

EDIT :
I wrote some more code that only picks the currently selected mails. This code only works if one mail is selected even though the loop touches all mails. If I select more than one mail only the first selected mail may (yes, may) have changed.

While looking for something else I ran into another Outlook-question and had an enlightening moment. The code sample there includes the line

Item.Save

which I had not in my code. I added the line after all manipulations on the mail-item and now it works flawlessly. It even works with many mails selected.

Some solutions are quite simple...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM