Outlook加载项电子邮件项目标记 [英] Outlook Add-in email item marks

查看:129
本文介绍了Outlook加载项电子邮件项目标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个建议.我们正在使用.net开发Outlook加载项,如果有一种方法可以为电子邮件创建一些自定义标记,则需要进行调查.我们需要根据是否在该电子邮件上执行过操作来对该电子邮件执行操作,并在Outlook UI上显示此条件(例如已读",未读").你能建议点什么吗?

I need an advice. We're developing an Outlook add-in with .net, and i need to investigate, if there's a way to create some custom marking for emails. We need to perform an operation on the email, depending on whether it was performed on that email before or not, and display this condition on the Outlook UI (like "read", "unread"). Could you advice something?

推荐答案

您可以在Outlook 2007或更高版本中使用类别"来执行此操作.类别是一种适用于此的颜色编码标签系统,因为您可以在电子邮件中放置一个或多个类别,并且插件可以根据需要创建新的类别.遗憾的是,我在C#中没有有用的示例代码,但在VB.net中确实有一些应该仍然有用. :)

You can do this with Categories in Outlook 2007 or later. Categories are a color coding label system that work well for this because you can put one or more categories on an email, and the addin can create new categories as needed. Sadly I don't have useful example code in C#, but I do have some in VB.net that should still be helpful. :)

对于您的特定问题,您将处理电子邮件,然后使用类别来标记您已经处理了这些电子邮件.由于类别标签也显示在UI中,因此用户将能够轻松看到它.

For your specific problem you'd process the emails, then use a category to mark that you'd already processed those emails. Because category labels also show up in the UI, the user will be able to see it easily.

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)

这篇关于Outlook加载项电子邮件项目标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆