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)
答案 0 :(得分:1)
为什么要调用Recipient.ToString()(来自.Net,而不是OOM)而不是使用Recipient.Name/Address/etc。特性