Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lotus Notes
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00566682
Message ID:
00566883
Views:
10
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
Map
View

Click here to load this message in the networking platform