PDA

View Full Version : Getting all the subject title from lotus notes inbox



lockwater
07-03-2017, 04:14 PM
Hi,

Please help me to get all the Lotus Notes inbox. i already get some of the inbox subject title but when i manually check the number of total inbox on that day it was not the same it looks like not all the email subject title is inserted on my database here's my code :


Dim NSession1 As Object 'NotesSession
Dim NMailDb1 As Object 'NotesDatabase
Dim NDocs1 As Object 'NotesDocumentCollection
Dim NDoc1 As Object 'NotesDocument
Dim NNextDoc1 As Object 'NotesDocument
Dim NItem1 As Object 'NotesItem
Dim view1 As String
Dim filterText1 As String
Dim subject0 As String
Dim deli As Date

'Dim oConn As ADODB.Connection
'Dim rs As ADODB.Recordset
Dim conn01 As MySqlConnection
Dim cmd01 As New MySqlCommand

DateTimePicker3.Format = DateTimePickerFormat.Custom
DateTimePicker3.CustomFormat = "MM/dd/yyyy"
Label7.Text = DateTimePicker3.Text
conn01 = New MySqlConnection()
conn01.ConnectionString = mMySQLConnectionString

view1 = "$All" 'Name of view or folder to retrieve documents from
view1 = "($Inbox)"


filterText1 = "" + Label7.Text + "" 'Optional text string to filter the view

NSession1 = CreateObject("Notes.NotesSession")
NMailDb1 = NSession1.GetDatabase("", "") 'Default server and database

If Not NMailDb1.IsOpen Then NMailDb1.OpenMail()

NDocs1 = NMailDb1.GetView(view1)
' NDocs1.Clear()

'Apply optional filter

If filterText1 <> "" Then
NDocs1.FTSearch(filterText1, 0)
End If

NDoc1 = NDocs1.GetFirstDocument

Do Until NDoc1 Is Nothing
NNextDoc1 = NDocs1.GetNextDocument(NDoc1)
NItem1 = NDoc1.GetFirstItem("Subject")
If Not NItem1 Is Nothing Then
subject0 = NDoc1.GetItemValue("Subject")(0)
Dim subj As String = Strings.Right(Strings.Left(subject0, 18), 14)
Dim subject01 As String = Strings.Right(Strings.Left(subject0, 19), 11)
Dim subjecttrim As String = Strings.Right(Strings.Left(subject0, 19), 11)
Dim subjectx As String = "***-" + subj
deli = NDoc1.GetItemValue("DeliveredDate")(0)

cmd01.CommandText = "INSERT INTO acd_cds.ln (`subject`,`fsubject`,`subjectrim`,`subject***`, `postdate`) VALUES ('" & subj.Replace("'", "''") & "','" & subject0.Replace("'", "''") & "','" + subjecttrim.Replace("'", "''") + "','" & subjectx.Replace("'", "''") & "','" & Format(deli, "yyyy-MM-dd HH:mm:ss") & "')"

cmd01.Connection = conn01
conn01.Open()

cmd01.ExecuteNonQuery()

conn01.Close()

End If
NDoc1 = NNextDoc1
Loop


NMailDb1.Close()
NSession1.Close()

NSession1 = Nothing


Thanks