Is it possible to attach files from web server in script ? (i.e. VBScript, Lotus Script etc.)
Given below is a sample code (in VBScript) that opens a Notes Document with all fields set and attachments attached and opens the Notes UI.
It works fine when the attachment is on local drive, when the attachment path is a virtual path (e.g. http://myserver/myfolder/myattachment.txt), it results in error.
Does Lotus Notes support web server attachments via scripting?
Sub OpenSendReadyWindow()
Set oNotesSession = CreateObject(“Notes.NotesSession”)
Set oDb = oNotesSession.GetDatabase(“”, “”)
if oDb.IsOpen = False then
oDb.OpenMail 'open mail
end if
Set oMailDoc = oDb.CreateDocument
oMailDoc.SaveDocumentOnSend = True
Set oAttachment = oMailDoc.CreateRichTextItem(“Attachment”)
‘The line below results in error’
Set oEmbedObj = oAttachment.EmbedObject(1454,“”,“http://localhost/MyApplication/Attachments/test.txt","Attachment1”)
‘‘The line below works well’’‘’
Set oEmbedObj = oAttachment.EmbedObject(1454,“”,“C:\test.txt”,“Attachment2”)
‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’
’ Filling the fields
oMailDoc.Subject = “New Issue”
oMailDoc.SendTo = “john101@mydomain.com”
oMailDoc.Body = “Sample document”
Set oWorkspace = CreateObject(“Notes.NotesUIWorkspace”)
’ Positioning cursor in body
Call oWorkspace.EditDocument(True, oMailDoc).GotoField(“Body”)
End Sub