I am sending an email to my self using Notes API. The code looks like this:
Sub Main()
Try
Dim oNotesDoc As NotesDocument
Dim strOrganizer As String = "CN=System Adminstrator/O=PMT"
Dim oRTF As Object
oNotesDoc = clsLotusFunctions.NamesDatabase.CreateDocument()
With oNotesDoc
clsLotusFunctions.GenerateLotusMemo(oNotesDoc)
oRTF = .CreateRichTextItem("Body")
oRTF.AppendText("Body")
.ReplaceItemValue("Subject", "Subject")
.ReplaceItemValue("Importance", "2")
.ReplaceItemValue("From", strOrganizer)
.ReplaceItemValue("AltFrom", strOrganizer)
.ReplaceItemValue("SendTo", strOrganizer)
.ReplaceItemValue("$StorageTo", "1")
.ReplaceItemValue("InetSendTo", strOrganizer)
.SaveMessageOnSend = True
.Send(True)
Console.WriteLine("Message Sent")
End With
Catch exc As Exception
Console.WriteLine("Error: " + exc.ToString)
End Try
Console.Read()
Randomly message is not saved in “Sent” folder and an error message is thrown:
Database already contains a document with this ID (UNID)
The error appears only when sending message to the same user, as a sender.
Any ideas why does it happen and how situation like this could be avoided?
TIA
Edmundas