Using Redemption in Integration Manager

G

Guest

I'm trying to use Redemption to programmatically send out emails via Outlook
from a script written to run from Integration Manager 9.0. I'm following the
VBScript conventions, but it doesn't seem to recognize the Redemption object.

Does anyone have any insight or familiarity with this?

Thank you
 
D

Dmitry Streblechenko

What are the relevant snippets of your code and what exactly do you mean by
"it doesn't seem to recognize the Redemption object"?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
G

Guest

Here is the code. As I mentioned, this is in Microsoft's Integration Manager
app for Great Plains. Written as a script, using the VBScript examples from
your FAQ section on the Redemption Object site. It is Integration Manager
9.0, associated with Great Plains 9.0, running on a Windows 2000 Server
machine, with Outlook 2003 (sp2)

Dim rMail
Dim oItem
Dim ns
'Dim Sync

'Create the Redemption Object to be used in this program
Set rMail = CreateObject("Redemption.SafeMailItem") 'New
Set oItem = Application.CreateItem(0)
rMail.Item = oItem
MsgBox (" passed by create Object - Outlook app")

' Testing against my email address
rmail.recipients.Add "(e-mail address removed)"
rmail.recipients.ResolveAll
MsgBox ("passed mail item to: ")

' Create the body of the email
strmessage = "Your GL batch " & BatchID & " was loaded successfully.
" & VbCrLf & VbCrLf _
& "Date Loaded: " & Date() & Space(5) & "Time Loaded: " & Time()
& VbCrLf & VbCrLf _

' Create the Subject
strsubject = (" " & CO & " Using Outlook: Trial Balance Has Been Imported
& Posted to Great Plains Successfully")
MsgBox ("passed by mail message content ")

' Set the message and subject
rmail.subject = strsubject
rmail.body = strmessage
MsgBox ("passed the body and subject lines")

'Send the e-mail
rmail.Send

--The error returned is "Object Required 'Application'" Occurring where I
use Application.CreateItem(0) to create the oItem.
 
D

Dmitry Streblechenko

Application variable there refers to an instance of the Outlook.Application
object, so it really has nothing to do with Redemption.
If your code is running anywhere but Outlook VBA (which exposes Application
as an intrinsic object), you need to initialzize it using something like

set Application = CreateObject("Outlook.Application")
set NS = Application.GetNamepace("MAPI")
NS.Logon

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
G

Guest

OK, it runs, thank you. One remaining issue. If I do not have Outlook open,
the app prompts me for an Outlook profile. Is it possible to pass the logon
and password as parameters on the NS.Logon line?
 
G

Guest

Clarification: I have the NS.Logon. As the script is running in IM, after
the Send method, sometimes I get a popup window prompting me for an Outlook
profile and password.
 
D

Dmitry Streblechenko

I am not sure which popup you mean: there is a profile prompt password (if
you specified to be prompted in the Mail Control Panel applet) and the login
dialog if you are using the Exchange provider and you are logged in as a
Windows user other than the one who owns the mailbox in the profile.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
G

Guest

Here is the code I have in the Integration Manager script:
**************************
Dim rMail
Dim oItem
Dim pOutlook
Dim ns
Dim Sync

'Create the Redemption Object to be used in this program
Set rMail = CreateObject("Redemption.SafeMailItem") 'New
Redemption.SafeMailItem
Set pOutlook = CreateObject("Outlook.Application")
Set oItem = pOutlook.CreateItem(0)
rMail.Item = oItem
MsgBox (" passed by create Object - Outlook app")

'Get Outlooks Namespace - use this code when using POP3
Set ns = pOutlook.GetNamespace("MAPI") 'Application.GetNamespace("MAPI")
ns.Logon "username", "password", False, True
Set Sync = ns.SyncObjects.Item(1)
MsgBox (" passed by created getnamespace ")
******************************************
When I run Integration Manager, I get a popup before it will send the email
that asks:
User Name:
Password:
Domain Name:

In this popup, the user name and domain name have values in them. What
concerns me is that this process is going to be run on a Citrix machine, so
different users will be logging in. None of them have the same user logon as
the one used to process the IM script (and Great Plains functionality), and
send the email. I thought by providing the username and passord in my
NS.logon line that this would eliminate the popup. The email will only send
out properly if I supply the password in the popup window when it comes up.
 
D

Dmitry Streblechenko

1. Namespace.Logon takes the name of the *profile*, not the user
name/password. Or pass "" to use the default profile. Or don't specify any
parameters at all
2. Move the lines

Set ns = pOutlook.GetNamespace("MAPI") 'Application.GetNamespace("MAPI")
ns.Logon

to immediately after

Set pOutlook = CreateObject("Outlook.Application")

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
G

Guest

OK, here's the situation. This process is supposed to run on a Citrix
server. A user connects in to the Citrix Server, using their NT Domain logon
and password. Once logged in, they run a C# application. This C#
application then executes Integration Manager. When in Integration Manager,
scripts are run. From these scripts, there is a logon to Outlook for the
email (the NS.logon event listed below for example). Since it is run from
the Integration Manager script, the logon and password of the profile for the
NS.logon segment is different than what the user has logged on to Citrix as.
Despite setting Outlook on the Citrix box to not display the message box
asking for a profile, and supplying a valid profile with password, we still
receive the pop up asking for a profile and password. We need to do this
programmatically and cannot see the profile pop-up. Going from your previous
responses, I thought what I had coded would do this.
 
D

Dmitry Streblechenko

If Outlook is already running in the context of the current user, you cannot
launch a second instance of Outlook.
And there is no such as thing as a profile password. The password prompt is
displayed by the EX provider if it cannot authenticate with the eEX server
using the credentials of the current user.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
G

Guest

For Integration Manager to run, it needs to be run through GreatPlains.
While the user is logged on to the Citrix machine under their domain logon,
the Integration Manager (which calls the email functionality) uses the logon
of, in my case, gpimport. When the IM script is run, I get a following
pop-up which is titled "Microsoft Office Outlook - Enter Password. It has
the gpimport User Name, a Domain Name, and is prompting for a password. The
gpimport logon is a valid account/profile within the Windows system, as well
as a valid profile in Outlook. It is this pop-up which is causing my
problems.
 
D

Dmitry Streblechenko

The fact that you get that prompt, means that the code does not run the user
identity of the mailbox owner. Is it running as the "gpimport" user? If
yes, you cannot get rid of that prompt unless you give gpimport user full
rights over all the mailboxes that you are trying to access.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top