View Single Post
  #1  
Old July 4th 06, 06:35 AM posted to microsoft.public.outlook.program_vba
pnp
external usenet poster
 
Posts: 8
Default Outlook: Mark a mailitem as complete

Hi

I have a problem marking a mailitem as complete, and having the 'V' icon
appear in the Outlook UI. Im coding a VSTO Addin (C#).

What i am doing is in short this:

1. When outlook receives a mail a test it for subject, and if "valid" i move
it to another folder.
2. In this folder i mark the mail with a red flag.
3. I then examine the mail, does some sql and so forth..
4. When done, i want to flag the mail complete if all went well.

1,2,3 is fixed (nr 2 after reading :
http://forums.microsoft.com/MSDN/Sho...8162&SiteID=1). Below
is some of my sourcecode (all the relevant).

My problem is that the mail keeps the red flag icon even though it is marked
as complete. How do I get this 'completedIcon' to appear instead?

Best regards
Anders

------------ CODE EXAMPLE START ------------

//move the mail
Outlook.MailItem movedMail =
(Outlook.MailItem)newMail.Move(myOutlookFolder);
//Get the movemail again, necessary to avoid the movedMail being marked as
not sent
movedMail =
(Outlook.MailItem)GetNamespace("MAPI").GetItemFrom ID(movedMail.EntryID,
myOutlookFolder.StoreID);

// mark as read, red flag, and save
movedMail.UnRead = false;
movedMail.FlagStatus =
Microsoft.Office.Interop.Outlook.OlFlagStatus.olFl agMarked;
movedMail.FlagIcon =
Microsoft.Office.Interop.Outlook.OlFlagIcon.olRedF lagIcon;
movedMail.Save();

//Do my actions on the mail, sql, xml and so forth.
// ......

//When all goes good - set flagstatus as complete and save.
movedMail.FlagStatus =
Microsoft.Office.Interop.Outlook.OlFlagStatus.olFl agComplete;
movedMail.Save();

------------ CODE EXAMPLE END ------------



Ads