Discovered the problem. Turns out that not only does the job have to be
the DTS package itself. The DTS package was owned by an sysadmin on the
server, but not the same admin as the SQL Agent Service account. Once I
"Darren Green" <darren.green@reply-to-newsgroup-sqldts.com> wrote in message
news:u8JMRzBa0UHAFwEj@sqldts.com...
> In message <uUwMeNC6DHA.3308@TK2MSFTNGP11.phx.gbl>, Perry Provost
> <perry.provost@hp.com> writes
> >Hi,
> > I have created a VBScript in an ActiveX object using CDO 1.21 to
> >connect to our Exchange server, look for an email with a specific Subject
> >Line and save the attachments into a directory folder on the server. The
> >attachments contain raw data which are later imported into tables.
> > The script runs perfectly from the Microsoft script editor. When I
> >execute the script in the opened DTS package, it runs fine. However, when
I
> >run the DTS package as a SQL job, the package fails with the error the
> >MAPI_E_LOGIN_FAILED. I should mention that when I run the opened DTS
package
> >manually, I am logged in using the same account as the SQL Server Agent.
All
> >other mail operations in both DTS packages and SQL Mail work fine. I am
> >using Windows Server 2003/SQL2000 Enterprise/Outlook 2002 with all the
> >latest patches.
> >
> >Any ideas why the script fails?
> >
> >Perry Provost
> >perry.provost@hp.com
> >
>
> When running this manually you are logged on as the SQL Agent service
> account, but is this on the server or your desktop? If not try it on the
> server.
>
> Is the job owned by a sysadmin, if not it will not execute under the
> context of the SQL Agent service account, instead it uses the proxy
> account.
>
> If none of the above helps, it could be something esoteric with CDO, and
> I am not expert on CDo, but since it sounds like permissions, I would
> add some code to the ActiveX Script that writes out the current user
> (see WScript.Network object) to double check it really is executing
> under the user you think.
>
>
> --
> Darren Green (SQL Server MVP)
> DTS -
http://www.sqldts.com >
> PASS - the definitive, global community for SQL Server professionals
>
http://www.sqlpass.org >