我需要从用户指定的Outlook 2013联系人组中检索电子邮件地址。我在别处找到的这个VBA代码工作得很好,但我需要将它转换为C#。我找到的所有C#示例都从联系人列表而不是用户创建的联系人组中提取地址。任何帮助将不胜感激。
Public Function GetContactGroupAddresses()
Dim I As Integer
Dim AddressList As String
Dim Group As String
Dim olApp As Outlook.Application
Dim myNamespace As Object
Dim myFolder As Object
Dim myItem As Object
Dim WordApp As Object
AddressList = " "
Group = "EmailTest"
Set olApp = New Outlook.Application
With olApp
Set myNamespace = .GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderContacts)
Set myItem = myFolder.Items(Group)
For I = 1 To myItem.MemberCount
AddressList = AddressList & myItem.GetMember(I).Address
End With
GetContactGroupAddresses = AddressList
End Function