djam21
Messages postés11Date d'inscriptionsamedi 19 novembre 2005StatutMembreDernière intervention 5 juin 2007
-
5 juin 2007 à 14:43
coin16
Messages postés2Date d'inscriptionjeudi 31 juillet 2008StatutMembreDernière intervention 7 octobre 2008
-
7 oct. 2008 à 10:43
Bonjour,
J'effectue une extraction des fichiers attachés des mails reçus par l'intérmédiaire de Lotus Notes. Mais j'aimerai juste me limiter au dossier "Courrier en arrivée". Comment je peux le faire?
Mon disque dur risque de ne pas apprécier...
djam21
Messages postés11Date d'inscriptionsamedi 19 novembre 2005StatutMembreDernière intervention 5 juin 2007 5 juin 2007 à 15:14
Public Sub ReceivedNotesMail()
Dim Session As Object 'The notes session
Dim UserName As String 'The current users notes name
Dim Maildb As Object 'The mail database
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim MailFile As Object
Dim item As Object
Dim obj As Variant
Dim Compteur As Integer
Compteur = 0
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GetDatabase("", MailDbName)
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set Dir = Sess.GetDbDirectory("")
'Set DB = Dir.OpenMailDatabase
Set MailFile = Maildb.AllDocuments
Set MailDoc = MailFile.GetFirstDocument
Do While Not (MailDoc Is Nothing)
Set item = MailDoc.GetFirstItem("Body")
If (item.Type = RICHTEXT) Then
If Not IsEmpty(item.EmbeddedObjects) Then
For Each obj In item.EmbeddedObjects
If (obj.Type = EMBED_ATTACHMENT) Then
Call obj.ExtractFile("P:\Documents\ESSAI" + Format(Compteur, "00000_") + obj.Name)
Compteur = Compteur + 1
End If
Next
End If
End If
Set MailDoc = MailFile.GetNextDocument(MailDoc)
Loop
Set item = Nothing
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
La solution doit se trouver dans cette ligne ( Set MailFile = Maildb.AllDocuments ) , mais je ne connais pas la commande qui me permet de le faire...
Et au cas où, comment supprimer un mail dans Lotus???
coin16
Messages postés2Date d'inscriptionjeudi 31 juillet 2008StatutMembreDernière intervention 7 octobre 2008 7 oct. 2008 à 10:43
Oups....
J'ai oublié de mettre la fonction Movetofolder....
Function moveToFolder(dbMailbox As NotesDatabase, docMailbox As NotesDocument, folderName As String) As Boolean
Dim docMailBoxCopy As NotesDocument
On Error GoTo handleError
Set docMailBoxCopy = docMailbox.CopyToDatabase(dbMailbox)
docMailBoxCopy.PutInFolder folderName, True
docMailbox.Remove True
On Error GoTo 0
moveToFolder = True
Exit Function
handleError:
MsgBox "Error # " & Err & " : " & Error$ & " - line " & Erl, 16, "DEMOA Notes Error - moveToFolder"
End Function