You can do this using categories in Outlook 2007 or later. Categories is a color coding shortcut system that works well for this, because you can put one or more categories in email, and addin can create new categories as needed. Unfortunately, I don't have useful code in C #, but I have some in VB.net that will still be useful. :)
For your specific problem, you have processed emails, and then use the category to indicate that you have already processed these emails. Since category labels are also displayed in the user interface, the user can easily see it.
Private Shared ReadOnly CATEGORY_TEST As String = "Custom Overdue Activity"
' This method checks if our custom category exists, and creates it if it doesn't.
Private Sub SetupCategories()
Dim categoryList As Categories = Application.Session.Categories
For i As Integer = 1 To categoryList.Count
Dim c As Category = categoryList(i)
If c.Name.Equals(CATEGORY_TEST) Then
Return
End If
Next
categoryList.Add(CATEGORY_TEST, Outlook.OlCategoryColor.olCategoryColorDarkOlive)
End Sub
' This snippet creates a new Task in Outlook, and assigns the category.
' The process for categories is similar when putting them on an email instead.
' Some of the data here is coming from a web service call in a larger app, you can ignore that. :)
Dim task As Outlook.TaskItem = DirectCast(Application.CreateItem(Outlook.OlItemType.olTaskItem), Outlook.TaskItem)
task.DueDate = Date.Parse(activity.ActDate)
task.StartDate = task.DueDate
task.Subject = String.Format(subjectText, activity.AppID)
task.Body = String.Format(bodyText, activity.AppID, activity.FileNum, activity.AppID)
task.ReminderTime = Now.AddMinutes(10)
task.ReminderSet = True
task.Categories = CATEGORY_TEST
task.Save()
task.Close(OlInspectorClose.olDiscard)
source
share