Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Let user choose mail recipient via lotus notes automatio
Message
 
 
To
17/07/2001 03:23:59
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00530991
Message ID:
00531867
Views:
20
Hi Steve,
Here is an example of using the NotesUI... automation objects to do something like this. The code fills everything in and puts the cursor into the To field. It does not bring up the Address selection dialog. The user actually has select that from the Action buttons.
#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*
If this isn't exactly what you want, you can still use DDE. It's still supported.

Good luck!

>Hi Larry
>
>Thank you for your reply
>
>I am using Notes as an Automation server..... see code below
>
>Dim notesApp As Object '-- NOTESSESSION
>Set notesApp = CreateObject("Notes.NotesSession")
>Dim notesDB As Object '-- NOTESDATABASE
>Set notesDB = notesApp.GETDATABASE("", "")
>Dim notesDoc As Object '-- NOTESDOCUMENT
> notesDB.openmail
> Set notesDoc = notesDB.CREATEDOCUMENT
>
> With notesDoc
>
> For lnRecip = 0 To 4
> lcSendTo = aSendToArray(lnRecip)
>
> .SendTo "bowskill_steven@jpmorgan.com"
> .CopyTo = "arbuckle_jim@jpmorgan.com"
> .Subject = Trim(mailform.TextBox2.Text)
> .body = Trim(mailform.editme.Text)
> Dim notesAttachment As Object '-- NOTESITEM
> Set notesAttachment = .CREATERICHTEXTITEM("Attachment")
> notesAttachment.EMBEDOBJECT 1454, "", "filename.txt"
> .SendTo = lcSendTo
> .SEND False
> Next
> End With
> Set notesDoc = Nothing
> Set notesDB = Nothing
> Set notesApp = Nothing
>
>Yes I know it is written in VBA, but most of this code was plucked from A VFP
>example in UT.
>
>I can use DDE to achive what I want done..see code below, but I have real limits on the size of the text in the body, where as I can pass the code above a lot of text.
>
>
>***** DDE CODE
>
>
>channelNumber = Application.DDEInitiate("NOTES", "SENDMAIL")
>lnDoneit = Application.DDEExecute(channelNumber, "NewMessage")
> '' lnDoneit = Application.DDEExecute(channelNumber, "To ")
> '' lnDoneit = Application.DDEExecute(channelNumber, "Subject ")
> '' lnDoneit = Application.DDEExecute(channelNumber, "Text " & Trim(setupuser.mailtext.Value))
> lnDoneit = Application.DDEExecute(channelNumber, "Send")
> ''lnDoneit = Application.DDETerminate(channelNumber)
> Set channelNumber = Nothing
>
>I have tried to leave out the
>
>.SendTo "bowskill_steven@jpmorgan.com"
>.CopyTo = "arbuckle_jim@jpmorgan.com"
>
>In the hope that this will bring up the Address book screen of notes, as this works in the DDE version, but it does ot work here.
>
>Any ideas, code would be most appreciated.
>
>Once again, thanks for your time
>
>Regards
>
>Steven
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform