Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 23 JUL 2006 07:11:41PM Jim Vaughan wrote:

I am using Outlook 2003 SP2 on Windows XP.

The following code generates a error message from Outlook "The object could not be found"

What I am doing wrong?

Subroutine test(null)

$Insert MAPI_EQUATES

Declare Function MapiSendMail, MapiLogon, MapiLogOff

Message="

Message=Test subject"

[email protected]"

[email protected]"

If MapiLogon(session) then

If MapiSendMail(session, "main_tactic", MAPI_DIALOG$, message) then null
If MapiLogOff(session) then null

End

Return


At 24 JUL 2006 03:10AM Barry Stevens wrote:

Your code is similar to mine, but i have this, which appears I must have had a problem at some stage.

if TxtBody=" then TxtBody=.'

Message=TxtBody


At 24 JUL 2006 03:21AM Jim Vaughan wrote:

Code now reads as follows. It still gives the same error. One of my customers also has the same error.

Any ideas anyone?

Does anyone have this code (or similar) working with Outlook 2003?

Subroutine test(null)

$Insert MAPI_EQUATES

Declare Function MapiSendMail, MapiLogon, MapiLogOff

Message="

Message=Test subject"

[email protected]"

[email protected]"

Message=test text body"

If MapiLogon(Session) Then

If MapiSendMail(Session, "", MAPI_DIALOG$, message) Then null
If MapiLogOff(Session) Then null

End

Return


At 24 JUL 2006 08:06AM Bob Orsini wrote:

Jim, I thought I ran into this and found Mapi commands did not wotk on Xp (sp2). Could this be the case. If so you need to use send mail.


At 24 JUL 2006 12:48PM Jim Vaughan wrote:

What do the MAPI commands work under, Linux? Isn't WinXP SP2 what everyone uses nowadays?

Is this a problem in OI or is this something I might be able to work around by calling the WinAPI directly?

I have a user who wanted to send his email via Outlook, we already supported the smtp type of mail. I now have a user who thinks my product has a bug, which it does. Removing the feature I just added as a fix makes me look pretty stupid.

I didn't think this would be such a big deal the code seemed so simple that when I tested it (and it failed I thought it was due to the beta of Office I was using). I am now using Outlook 2003 and now find out that the real problem is that the code doesn't work with XP SP2.

Is this XP SP2 problem, a Outlook problem or an OI problem? Will this work with Eudora for instance under XP SP2?


At 24 JUL 2006 01:02PM John Bouley wrote:

Jim, I use this in my apps with XP SP2 no problem. This is designed to work to attach a Report (PDF) to an Email message. the difference is I don't fill in the Email address. The end user must do that.

Here is my code:

if findwindow(outlook$,0) else

 call nss_runwin("outlook",2)
  • wait until it opens
 Outlookopen=0
 loop
    if findwindow(outlook$,0) then outlookopen=1
 until outlookopen
    call delay(1)
 repeat

end

FLAGS=MAPI_LOGON_UI$

convert ";" to @vm in address

messageX="

messageX=Subject

messageX=address

messageX=message

messageX=MAPI_SENT$

stat=1

if MAPISendMail(0, 0, flags, messageX) else

Get_Status(display)
  • Msg(@window, display)
stat=0

end


At 24 JUL 2006 01:08PM Karen Oland wrote:

I have Mapi mail working under: 2000, XP SP2, 2003 (terminal server).

I think it's more of a failure of the help system, than a problem with your system (or that of others who think it doesn't work). The online help's example won't work at all (under any version of Windows I've tested). And for those who say it only supports Outlook and not Express, mine also works with Outlook Express (at least on XP Home SP2, which is the only version I tested, as some very small single-user systems insist on using off the shelf computers from their local big box stores). Our users insist on both access to their own address books and a record of sent mail - both taken care of automatically using mapimail and there is no new interface to worry about on my end. For some automated email messages (basically, tattling to the boss on users taking shortcuts), I am using BLAT, rather than sendmail, as it seemed simpler at the time.

Try something like this (note the missing info from your code, TYPE, which is required but never mentioned in the help example):

if DispWin then
	Flags=MAPI_LOGON_UI$ + MAPI_DIALOG$
end else
	Flags=MAPI_LOGON_UI$
end
Message='
Message=Subject
Message=Recipients
Message=CC
Message=BCC
Message=Body
Message=MAPI_RECEIPT_REQUESTED$
Message=IPM.Microsoft Mail.Note"
if len( Attachments ) then
	Message=Files
	Message=Attachments
	Message=FilePos
end		
if MAPISendMail(0, 0, Flags, Message) then
  if DisplayMsg then Msg(@window, "Message sent successfully!")
end else
  Get_Status(ErrorMsg)
  if DisplayMsg then Msg(@WINDOW, ErrorMsg)
end

At 24 JUL 2006 01:12PM Karen Oland wrote:

Out of curiosity, why do you open outlook for them? I never do and whatever mapi client is on the machine loads automatically. The first email being sent in a session has a slight delay (whether the client is already open or not), but after that, it is quite fast.

I also notice you don't set the TYPE parameter - on our systems, MAPI doesn't work at all unless we do (whether outlook is already open or not).


At 24 JUL 2006 01:27PM John Bouley wrote:

If I remember…I ran into problems with Outlook asking about profiles or some such. Also, this was done some time ago and since it is working I haven't wanted to spend the precious thought processes to revise.

Anyway, I suppose posting code can benifit two ways. First on the initial problem and then others can show "better" ways of doing the same thing.

Thanks for your feedback Karen.


At 24 JUL 2006 01:46PM Jim Vaughan wrote:

I have it working here as well, thanks to you. Thanks for the help it's very much appreciated.

As you say the missing code was the:

Message=IPM.Microsoft Mail.Note"

BTW if you need to send an attachment you seem to need to set

Message=IPM."

and guess what? It's actually documented here on the web site (someone should update the help file).

Docs here:

http://www.revelation.com/__85256DC100249E21.nsf/0/6113D28FA24618048525636500523D5F?Open&Highlight=0,MAPI

and here:

http://www.revelation.com/__85256DC100249E21.nsf/0/76A40887ECC79D2E852563C40063CD2D?Open&Highlight=0,MAPI


At 24 JUL 2006 02:30PM Karen Oland wrote:

Glad you have it working.

I send attachments with my code fairly often (such as from an automated routine that "prints" an invoice to PDF, then emails it as an attachment), so the .MailNote for TYPE must work (at least on our test systems and versions of outlook/express). Perhaps MS has updated things since the knowledge base articles so it doesn't matter for attachments anymore?


At 24 JUL 2006 06:46PM Barry Stevens wrote:

]]if findwindow(outlook$,0) else

]]call nss_runwin("outlook",2)

What is the value of outlook$

Does nss_runwin do anything other than being a wrapper for utility("RUNWIN"……….)


At 25 JUL 2006 09:26AM John Bouley wrote:

Equate Outlook$ to "mspim_wnd32":\00\

nss_runwin is a wrapper around the ShellExecute windows api function.

HTH,

John


At 25 JUL 2006 12:39PM Karen Oland wrote:

I'll keep the profiles thing in mind (I do know that in the latest XP and 2003 (with Express and outlook 2000), running without opening "outlook" will ask to create a mailbox for someone who is new to the machine. When I first started the code, I tried the code in the HELP (which neither opens outlook nor sets TYPE$) and had outlook 2000 open pretty much all the time and nothing ever happened (although I could open the mailbox without problems, but ended up never using that code at all, due to the way it returns data).

I have at least one customer, tho, that uses Eudora (and more than one using OE), so if opening the program first becomes an issue, I'll end up having to also store what program has to be opened first.

Thanks for the input,

Karen


At 25 JUL 2006 04:53PM Mike Ruane wrote:

I remember going through this once already on the website- trying to find out why it wasn't working. I guess we forgot to update the docs- we'll be sure to for the 8.0 release.

Thanks to Karen and Jim !


At 26 JUL 2006 02:00PM Jim Vaughan wrote:

Mainly with thanks to Karen; I was just bumbling around as usual….

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/1417e2c1882c8b74852571b4007f69ed.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1