General information
Category:
COM/DCOM and OLE Automation
Hi Charles
This code is from a reply I got from Larry miller, on who to instansiate the notes object model
Hope it helps
REGARDS
STEVEN
#define EMBED_ATTACHMENT 1454
local lnw, lcbody, osession, omaildb, ouiworkspace, ouidoc, lobody
declare integer FindWindow in user32 string,string
declare integer SetForegroundWindow in user32 integer
lcbody = replicate('AB',10000)
* gather some information behind the scenes and use that when
* manipulating the user interface
osession = createobject('notes.notessession')
omaildb = osession.GetDatabase('','')
omaildb.OpenMail()
* when using the UI automation objects, actions are reflected within
* the Notes user interface
ouiworkspace = createobject('notes.notesuiworkspace')
ouiworkspace.OpenDatabase('',omaildb.FilePath)
ouidoc = ouiworkspace.ComposeDocument('','','Memo')
With ouidoc
* set the values for the appropriate fields
.FieldSetText('Subject','Test Subject')
.FieldSetText('Body',lcbody)
.GotoField('Body')
* call the Refresh method in order to write the current UI information
* to the backend NotesDocument
.Refresh(.T.)
* get an object reference to the NotesRichTextItem (Body) in order to
* embed the file attachment
lobody = .Document.GetFirstItem('Body')
if vartype(lobody) = "O" then
lobody.EmbedObject(EMBED_ATTACHMENT,'','c:\dev\projects\texts\consid.txt')
endif
* make the To line the active field before the Notes window becomes active
.GotoField('EnterSendTo')
* use the class name to find the Notes window
lnw = FindWindow('NOTES',0)
if lnw <> 0 then
* make the Notes window the active window
SetForegroundWindow(lnw)
endif
Endwith
release all like o*
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only