Envoyer une pièce joint avec outlook

cs_dhabasse Messages postés 16 Date d'inscription lundi 6 février 2006 Statut Membre Dernière intervention 18 décembre 2011 - 29 avril 2008 à 01:11
cs_dhabasse Messages postés 16 Date d'inscription lundi 6 février 2006 Statut Membre Dernière intervention 18 décembre 2011 - 2 mai 2008 à 22:43
Slut tout le monde.

Je travail sur un petit programme de gestion et je voudais informé un client par mail  sur certins irregularités de ses factures le facture est en pdf 

 Outlook.Application outlookApp = new Outlook.ApplicationClass();
 Outlook._MailItem mail = (Outlook._MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
  
et ici je ne voi pas ce que je dois faire avec les autres paramertes du fonction 
  mail.Attachements() si ce n'est l'ObjetSource et l'ObjetDisplayName
mais  l'ObjetType et son suivant  je ne vois pas ce qu'il me faut

Si uquelqu'un peut m'aider

1 réponse

cs_dhabasse Messages postés 16 Date d'inscription lundi 6 février 2006 Statut Membre Dernière intervention 18 décembre 2011
2 mai 2008 à 22:43
Je vien de decouvrir cette code qui es en vb mais je l'est pas encor essayé

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

        ' Create a new MailItem.
        Dim oMsg As Outlook._MailItem
        oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
        oMsg.Subject = "Send Attachment Using OOM in Visual Basic .NET"
        oMsg.Body = "Hello World" & vbCr & vbCr

        ' TODO: Replace with a valid e-mail address.
        oMsg.To = "user@example.com"

        ' Add an attachment
        ' TODO: Replace with a valid attachment path.
        Dim sSource As String = "C:\Temp\Hello.txt"
        ' TODO: Replace with attachment name
        Dim sDisplayName As String = "Hello.txt"

        Dim sBodyLen As String = oMsg.Body.Length
        Dim oAttachs As Outlook.Attachments = oMsg.Attachments
        Dim oAttach As Outlook.Attachment
        oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)

        ' Send
        oMsg.Send()

        ' Clean up
        oApp = Nothing
        oMsg = Nothing
        oAttach = Nothing
        oAttachs = Nothing
    End Sub
0
Rejoignez-nous