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)
osession = createobject('notes.notessession')
omaildb = osession.GetDatabase('','')
omaildb.OpenMail()
ouiworkspace = createobject('notes.notesuiworkspace')
ouiworkspace.OpenDatabase('',omaildb.FilePath)
ouidoc = ouiworkspace.ComposeDocument('','','Memo')
With ouidoc
.FieldSetText('Subject','Test Subject')
.FieldSetText('Body',lcbody)
.GotoField('Body')
.Refresh(.T.)
lobody = .Document.GetFirstItem('Body')
if vartype(lobody) = "O" then
lobody.EmbedObject(EMBED_ATTACHMENT,'','c:\dev\projects\texts\consid.txt')
endif
.GotoField('EnterSendTo')
lnw = FindWindow('NOTES',0)
if lnw <> 0 then
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.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao