Outlook 加载项电子邮件项目标记

发布于 2024-10-15 13:00:15 字数 142 浏览 3 评论 0原文

我需要建议。我们正在使用 .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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

是伱的 2024-10-22 13:00:15

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

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

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)

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. :)

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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文