【问题标题】:VB.NET how to extract recipients for an Outlook appointment?VB.NET 如何提取 Outlook 约会的收件人?
【发布时间】:2014-03-09 08:20:17
【问题描述】:

NET 开发人员。 我正在尝试在 VB.NET 中复制我在 Outlook VBA 中编写的内容。我在 VBA 中编写了一个函数来提取收件人并将它们保存到一个字符串中,这是在一个函数中完成的。下面的代码是我在 VB.NET 中的尝试,目前它并没有真正起作用(SplitTarget 数组具有唯一 ID,我目前正在第一个元素上对其进行测试)。

你能告诉我哪里出错了吗?

    Dim Recipients As String
    Dim Obj As Object
    Dim types() As String

    types = Split("MailItem,AppointmentItem,JournalItem,MeetingItem,TaskItem", ",")
    Select Case True
        ' these items have a Recipients collection
        Case UBound(Filter(types, TypeName(objNamespace.GetItemFromID(GlobalVariables.splitTarget(0))))) > -1
            Obj = objNamespace.GetItemFromID(GlobalVariables.splitTarget(0))
            GlobalVariables.recips = Obj.Recipients
        Case TypeName(objNamespace.GetItemFromID(GlobalVariables.splitTarget(0))) = "Recipients"
            GlobalVariables.recips = objNamespace.GetItemFromID(GlobalVariables.splitTarget(0))
    End Select

   For k = 1 To GlobalVariables.recips.Count
        If GlobalVariables.recips(k).ToString <> "Caseflow System" Then
            If Recipients = "" Then
                Recipients = GlobalVariables.recips(k).ToString
            Else
                Recipients = Recipients & ";" & GlobalVariables.recips(k).ToString
            End If
        End If
    Next

    MsgBox("Recipients are: " + Recipients)

【问题讨论】:

    标签: vb.net outlook-addin


    【解决方案1】:

    您为什么要调用 Recipient.ToString()(来自 .Net,而不是 OOM)而不是使用 Recipient.Name/Address/etc。属性?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-26
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      • 2012-09-20
      • 1970-01-01
      相关资源
      最近更新 更多