在Outlook中选择正确的联系人 [英] Select correct contact in Outlook

查看:188
本文介绍了在Outlook中选择正确的联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Try
        ' Create an Outlook application.
        Dim oApp As Outlook._Application = New Outlook.Application()

        ' Get the MAPI namespace.
        Dim oNS As Outlook.NameSpace = oApp.Session

        ' Get the Global Address List.
        Dim oALs As Outlook.AddressLists = oNS.AddressLists
        Dim oGal As Outlook.AddressList = oALs.Item("Contacts")

        ' Get all the entries.
        Dim oEntries As Outlook.AddressEntries = oGal.AddressEntries
        Dim oEntry As Outlook.AddressEntry

        Dim i As Integer

        For i = 1 To oEntries.Count

            oEntry = oEntries.Item(i)
            ComboBox1.Items.Add(oEntry.Name)
        Next

    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    Try
        ' Create an Outlook application.
        Dim oApp As Outlook._Application = New Outlook.Application()

        ' Get the MAPI namespace.
        Dim oNS As Outlook.NameSpace = oApp.Session

        ' Get the Global Address List.
        Dim oALs As Outlook.AddressLists = oNS.AddressLists
        Dim oGal As Outlook.AddressList = oALs.Item("Contacts")


        ' Get all the entries.
        Dim oEntries As Outlook.AddressEntries = oGal.AddressEntries
        Dim oDL As Outlook.AddressEntry
        oDL = oEntries.Item(ComboBox1.SelectedItem.ToString)

        TextBox2.Text = oDL.GetContact.FullName

    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
End Sub





问题是:



ComboBox1.SelectedItem =所选联系人

oDL =下一个联系ComboBox1而不是s当选联系人



任何帮助都会很棒Thanx

Tim



The problem is;

The ComboBox1.SelectedItem = the selected contact
The oDL = the next contact in ComboBox1 NOT the selected contact

Any help would be great Thanx
Tim

推荐答案

这篇关于在Outlook中选择正确的联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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