Cita:
Adjunto mi codigo un programa intenta obtener acceso a direcciones de correo de Outlook.............
Código vb:
Ver original
Protected Sub obtenerContactos() Dim tempApp As Outlook.Application Dim tempInbox As Outlook.MAPIFolder Dim InboxItems As Outlook.Items 'Dim objattachments, objAttach tempApp = CreateObject("Outlook.Application") tempInbox = tempApp.GetNamespace("Mapi").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox) InboxItems = tempInbox.Items Dim dtCorreos As New DataTable() dtCorreos.Columns.Add("Para") dtCorreos.Columns.Add("Asunto") dtCorreos.Columns.Add("Contenido") Dim i As Integer = 0 For Each mail As Outlook.MailItem In InboxItems If i = 2 Then Exit For End If dtCorreos.Rows.Add(mail.Sender, mail.To, mail.Body) i += 1 Next InboxItems = Nothing tempInbox = Nothing tempApp = Nothing gvOutlook.DataSource = dtCorreos End Sub