I am working on an integration where I have to extract lotus email documents on regular intervals of 2 min. I have created a PowerShell script to connect to local notes client. I am successful to read the latest document but I am unable to put a time filter to get last 5 min email from notes database. I also tried to get documents which are not yet read by the lotus notes ID which I used to connect to a lotus notes database.
This is for a new integration to retrieve past 5 min documents or documents which are not read by the current lotus notes ID used inside Powershell script. I was able to get only the latest document but when I applied the time filter it gives me values which are not matching the real values when I checked inside lotus notes.
$DomSession = New-Object -ComObject Lotus.NotesSession
$DomSession.Initialize()
$DomDatabase = $DomSession.GetDatabase("DominoServer","email.nsf")
Write-Host "Database open : " $DomDatabase.Title
$DomView = $DomDatabase.GetView('All By Category')
Write-Host "View read : " $DomView.Name
$DomNumOfDocs = $DomView.AllEntries.Count
Write-Host "Num of Docs : " $DomNumOfDocs
$DomDoc = $DomView.GetFirstDocument()
$DomDoc.ColumnValues #This gives the latest email document
Do {
$checks = $DomDoc.Items
foreach ($check in $checks) {
if ($check.Name -eq 'Subject') {
[pscustomobject]@{
subject = $check.Text
creationtime = $check.LastModified
}
}
}
$DomDoc = $DomView.GetNextDocument($DomDoc)
}
while ($DomDoc.LastModified -gt ((get-date).AddMinutes(-5)))
I expect to get email documents created for the past 5 min or so, but I get all documents inside the notes database.
$searchDate = (Get-Date).AddMinutes(-5)
– user6811411