View Single Post
  #7  
Old July 7th 06, 12:13 PM posted to microsoft.public.outlook.program_vba
pnp
external usenet poster
 
Posts: 8
Default Outlook: Mark a mailitem as complete

Now it seems to work. I have added some more properties, and it seems to work
fine now.

Heres the C# code i use to mark the mailitem complete.

---------- CODE BEGIN ------------
private void markMailItemComplete(Outlook.MailItem email)
{
email.FlagIcon =
Microsoft.Office.Interop.Outlook.OlFlagIcon.olNoFl agIcon;
email.FlagStatus =
Microsoft.Office.Interop.Outlook.OlFlagStatus.olFl agComplete;
email.FlagRequest = "Completed";
email.ReminderSet = false;
email.Save();
}
----------- CODE END -------------

This seems to do the trick. I don't know if it was because I was missing the
FlagRequest and ReminderSet before or just because the order was another, I
think i sat the FlagComplete status before FlagIcon = olNoFlagIcon?

Anyway, it seems to work as supposed now.

So have a nice weekend, and thanks for your help.

/Anders

"pnp" wrote:

If I understand VB6 correct, empty is what in VB.NET is Nothing, equal to
'null' in C#.

But - I can't set the FlagIcon to null in C# because it's a value property
and not an object.

Any other ideas?

/Anders

"pnp" wrote:

I have almost the same code..

What would "empty" translate to in .NET? I set the flagIcon = olNoFlagIcon.
That might be the difference.

Otherwise i do the same, except for the FlagCompleteTime.

/Anders


"Ken Slovak - [MVP - Outlook]" wrote:

Well, I use VB 6 and Redemption code (www.dimastr.com/redemption) mostly so
I can access various properties that aren't exposed in the Outlook object
model to do what you're trying to do, so my code isn't directly translatable
into .NET code without the use of Redemption, but here's what I do:

Const FLAG_COMPLETED = 1

Const PR_FLAG_COMPLETE_TIME = &H10910040

With oMail
.ReminderSet = False

.FlagIcon = Empty

.FlagStatus = FLAG_COMPLETED

'times stored in GMT, convert local time to GMT
.Fields(PR_FLAG_COMPLETE_TIME) = rdmUtils.HrLocalToGMT(Now)

.Save
End With

The FlagCompleteTime property isn't exposed in the OOM, so that's what
Redemption would be needed for. I'm not sure if it would work without
setting that property, but the rest of the code should be translatable to
..NET code directly.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"pnp" wrote in message
...
I've done that. But that just makes the flag disappear. (as the name kind
of
says)

And appearently you can't mark a mail item complete without a flag.

At least thats my experience...

/Anders


Ads