Bonjour
Le code ci-dessous permet de lister les mails et leurs pièces jointes d'une base Lotus Notes. Cependant, il ne fonctionne pas pour lister les pièces jointes. Il plante ligne 45 avec une erreur 424 : Objet requis.
Quelqu'un pourrait-il me dire pourquoi ?
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 Public Sub getMails() Dim NSession As Object 'NotesSession Dim NMailDb As Object 'NotesDatabase Dim NDocs As Object 'NotesDocumentCollection Dim NDoc As Object 'NotesDocument Dim NNextDoc As Object 'NotesDocument Dim NItem As Object 'NotesItem 'Dim NFile As NotesFile 'NotesFile Dim obj As Object Dim EmbeddedObjects As Object Dim view As String Dim filterText As String view = "$INBOX" 'Name of view or folder to retrieve documents from 'view = "$SENT" 'Name of view or folder to retrieve documents from view = "$ALL" 'Name of view or folder to retrieve documents from filterText = "" 'Optional text string to filter the view Set NSession = CreateObject("Notes.NotesSession") Set NMailDb = NSession.GETDATABASE("", "") 'Default server and database If Not NMailDb.IsOpen Then NMailDb.OPENMAIL End If Set NDocs = NMailDb.GETVIEW(view) NDocs.Clear 'Apply optional filter If filterText <> "" Then NDocs.FTSEARCH filterText, 0, 32 End If Set NDoc = NDocs.GETFIRSTDOCUMENT Do Until NDoc Is Nothing Set NNextDoc = NDocs.GETNEXTDOCUMENT(NDoc) Set NItem = NDoc.GETFIRSTITEM("Body") If Not NItem Is Nothing Then Debug.Print "Sujet : " & NDoc.GETITEMVALUE("Subject")(0) Debug.Print "Date : " & NDoc.GETITEMVALUE("PostedDate")(0) If NDoc.HasEmbedded Then 'If Not IsEmpty(NItem.EmbeddedObjects) Then 'obj = NItem.GetEmbeddedObject For Each obj In NItem.EmbeddedObjects If (obj.Type = 1454) Then 'Debug.Print NotesEmbeddedObject("Name") End If Next End If 'MsgBox prompt:=NItem.Text, Title:=NDoc.GETITEMVALUE("Subject")(0) End If Set NDoc = NNextDoc Loop End Sub
Partager