none
Folder contactos de Exchange RRS feed

  • Pregunta

  •  

    con el codigo siguiente

      Dim objOutlook As OutLook._Application
            Dim objNS As OutLook._NameSpace

            Try
                objOutlook = New OutLook.Application()
                objNS = objOutlook.Session
                Dim objAddressList As OutLook.MAPIFolder

                'objAddressList = objNS.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderContacts)
                objAddressList = objNS.PickFolder

                Dim objItems As OutLook.Items = objAddressList.Items
                Dim objContact As OutLook.ContactItem
                Dim sConfirm As String = Nothing

                '''''
                Dim toAddress As String = Nothing
                Dim ccAddress As String = Nothing
                Dim sCategories As String = Nothing
                Dim sCompanyName As String = Nothing

                Dim x As Integer = 0

                For j As Integer = 1 To objItems.Count
                    objContact = objItems(j)
                    sCategories = objContact.Categories
                    sCompanyName = objContact.CompanyName
                    If sCategories = "Proveedores" And _
                       sCompanyName = dgvGrilla.CurrentRow.Cells("Nombre").Value.ToString Then
                        If x = 0 Then
                            toAddress = objContact.Email1Address
                            x = x + 1
                        ElseIf x > 0 Then
                            ccAddress = ccAddress & objContact.Email1Address & "; "
                        End If
                    End If
                Next
                If Not ccAddress Is Nothing Then
                    ccAddress = Mid(ccAddress, 1, (ccAddress.Length - 2))
                End If
                '''''

                If Not toAddress Is Nothing Then

                    sConfirm = _
                    "Confirmas el envio " & vbCrLf & _
                    "de mail a ....    " & vbCrLf & vbCrLf & _
                    "Para: " & toAddress & vbCrLf & _
                    "CC : " & ccAddress & vbCrLf & _
                    "Proveedor: " & sCompanyName & vbCrLf & _
                    "Tipo: " & sCategories

                    Dim Box As MsgBoxResult = MsgBox(sConfirm, MsgBoxStyle.YesNo)
                    If Box = MsgBoxResult.Yes Then
                        ''''''
                        Dim sSubject As String = "Pedido " & dgvGrilla.CurrentRow.Cells("Numero").Value.ToString & " " & dgvGrilla.CurrentRow.Cells("Nombre").Value.ToString & " para autorizar"
                        If File.Exists(PDFFile & dgvGrilla.CurrentRow.Cells("Numero").Value.ToString & ".PDF") Then

                            Dim sHTMLBody As String = ""
                            Dim sAttachmentFile As String = PDFFile & dgvGrilla.CurrentRow.Cells("Numero").Value.ToString & ".PDF"

                            'SendEmail("Subject", "HTMLBody", "AttachmentFilePath", "FromEmailAddress", "FromPassword", "ToEmailAddress", "CCEmailAddress", "BCCEmailAddress", "SMTPHost")
                            SendEmail(sSubject, sHTMLBody, sAttachmentFile, "administracion@landaluza.es", "Administracion2008", toAddress, ccAddress, "administracion@landaluza.es", "smtp.1and1.es")
                        Else
                            MsgBox("El fichero PDF: " & PDFFile & dgvGrilla.CurrentRow.Cells("Numero").Value.ToString & ".PDF" & " no existe!")
                        End If
                        ''''''
                    End If

                End If

                objContact = Nothing
                objItems = Nothing
                objAddressList = Nothing
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try

            objOutlook = Nothing
            objNS = Nothing

     

     

    Al seleccionar algunas de las carpetas de mis contactos en mi buzon del servidor Exchange, obterngo este error.

     

    No se pudo convertir el objeto COM del tipo "syte._ComObject' al tipo de

    interfaz 'Microsoft.Office.Interop.Outlook.ContactItem'. Ocurrió un error de
    operación debido a que la llamada QueryInterface en el componente COM para la
    interfaz con IID '{00063021-0000-0000-C000-000000000046}' generó el siguiente
    error: Interfaz no compatible (Excepción de HRESULT: 0x80004002
    (E_NOINTERFACE)).

     

    Lo curioso es que lo obtengo en algunas si y en otras no, cuando todas las propiedades son iguales.

     

    ¿alguna idea?

     

     


    Miguel Angel Martinez correomam@gmail.com
    viernes, 17 de diciembre de 2010 18:21