Link to home
Start Free TrialLog in
Avatar of CesarGon
CesarGonFlag for Spain

asked on

Accessing MAPI profile from stored procedure

Hi there.

I am trying to open a MAPI session (using the CDO library) from a SQL Server 2000 stored procedure, using the xp_OA* extended procedures. I can create the MAPI.Session object, but the Session.Logon method fails with an error saying that it could not log on to the mail system. I have tried to do the same in a VBScript file and it works perfectly. But it doesn't from within SQL Server.

Any ideas?
Avatar of sachinb
sachinb
Flag of United States of America image

A point which I have come across while using the xp_OA* procs if you are in the middle of the transaction, then these procs seem to behave abnormally. You could just check on that incase....
Avatar of CesarGon

ASKER

Thanks sachinb, but I am not using any transaction.
Read this and see if it is appropriate, I found it in SQL Server Books Online (I have SQL Server 7 but it is probably the same)

When running on Microsoft? Windows NT?, Microsoft SQL Server? and SQL Server Agent are started and run as Windows NT services named MSSQLServer and SQLServerAgent. For these services to run, they must be assigned a Windows NT user account. Both services may be assigned the same user account.


--------------------------------------------------------------------------------

Note Microsoft Windows? 95/98 does not support Windows NT services; instead, SQL Server simulates the MSSQLServer and SQLServerAgent services. You do not need to create user accounts for these simulated services.


--------------------------------------------------------------------------------

Three types of accounts can be assigned to SQL Server services:

Local system
Local user
Domain user
The local system and local user accounts do not have network access rights. Using a local account restricts SQL Server from interacting with other servers. Some server-to-server activities can be performed only with a domain user account. For example:

Remote procedure calls (RPCs)
Replication
Backing up to network drives
Heterogeneous joins that involve remote data sources
SQL Server Agent mail features and SQL Mail
This restriction applies if you are using Microsoft Exchange. Most other mail systems also require clients (MSSQLServer and SQLServerAgent) to be run on accounts with network access.

Thanks, mcmahon_s. We are using a domain user for SQL Server and SQL Server Agent.

We have done an interactive login to the machine in which SQL Server is running, and the VBS script works fine double-clicking it on the desktop, but fails when run by SQL Server. The only difference I can think of is that SQL Server is running as a service, while my session is running as an interactive session.

Any more ideas?
Did you run the script under the same login as the SQL Server is running?
Yes, of course.
ASKER CERTIFIED SOLUTION
Avatar of Mindphaser
Mindphaser

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial