![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
Try setting FlagIcon = olNoFlagIcon
-- 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 ... 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 ------------ |
#3
|
|||
|
|||
![]()
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 "Ken Slovak - [MVP - Outlook]" wrote: Try setting FlagIcon = olNoFlagIcon -- 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 ... 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 ------------ |
#4
|
|||
|
|||
![]()
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 |
#5
|
|||
|
|||
![]()
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 |
#6
|
|||
|
|||
![]()
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 |
#7
|
|||
|
|||
![]()
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 |
#8
|
|||
|
|||
![]()
Good, I'm glad you got it working.
I believe what you could supply instead of Empty for C# would be a System.MissingValue. I'll have to try that when I get a chance. -- 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 ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to mark appointment complete in outlook? | don | Outlook - Calandaring | 2 | June 20th 06 01:22 PM |
How do I mark task complete when not the owner? | CLSH | Outlook - Installation | 0 | May 19th 06 07:05 PM |
add a feature to outlook calendar to mark of days as they pass. | OUTLOOK FEATURE SUGGESTION | Outlook - Calandaring | 1 | May 19th 06 04:18 AM |
Creating an Outlook MailItem when Outlook hasn't been opened | WhytheQ | Outlook and VBA | 1 | May 11th 06 12:41 AM |
How can I create a MailItem that displays like a received MailItem ? | Clive | Outlook - Using Forms | 0 | February 27th 06 05:14 PM |