sp_OACreate + Outlook.Application

I'm trying to write an appointment item from SQL Server into Outlook using the following, but I cannt seem to get the outlook object to create properly. It runs for a couple of minutes and then obviously times out and I get a 'Server execution failed' message when I run it. Anybody got any idea why this isn't working. I tried it in VB using similar code and it worked fine. Has anybody got this to work?

DECLARE @OLK INT,
@Item INT,
@OLEResult INT,
@Source varchar(100),
@Description varchar(255)

EXECUTE @OLEResult = sp_OACreate 'Outlook.Application', @Olk OUT

Exec sp_OAGetErrorInfo @OleResult, @Source
OUTPUT, @Description OUTPUT

Print @Description
GO

Comments

  • : I'm trying to write an appointment item from SQL Server into Outlook using the following, but I cannt seem to get the outlook object to create properly. It runs for a couple of minutes and then obviously times out and I get a 'Server execution failed' message when I run it. Anybody got any idea why this isn't working. I tried it in VB using similar code and it worked fine. Has anybody got this to work?
    :
    : DECLARE @OLK INT,
    : @Item INT,
    : @OLEResult INT,
    : @Source varchar(100),
    : @Description varchar(255)
    :
    : EXECUTE @OLEResult = sp_OACreate 'Outlook.Application', @Olk OUT
    :
    : Exec sp_OAGetErrorInfo @OleResult, @Source
    : OUTPUT, @Description OUTPUT
    :
    : Print @Description
    : GO
    :
    I have a similar issue trying to write a MailItem. Did you ever get a reply or resolve this problem?
  • Hi,
    I never found a reply but from what I have read since, my next avenue of exploration is using CDO to create calendar items instead of the Outlook activex control.




    : : I'm trying to write an appointment item from SQL Server into Outlook using the following, but I cannt seem to get the outlook object to create properly. It runs for a couple of minutes and then obviously times out and I get a 'Server execution failed' message when I run it. Anybody got any idea why this isn't working. I tried it in VB using similar code and it worked fine. Has anybody got this to work?
    : :
    : : DECLARE @OLK INT,
    : : @Item INT,
    : : @OLEResult INT,
    : : @Source varchar(100),
    : : @Description varchar(255)
    : :
    : : EXECUTE @OLEResult = sp_OACreate 'Outlook.Application', @Olk OUT
    : :
    : : Exec sp_OAGetErrorInfo @OleResult, @Source
    : : OUTPUT, @Description OUTPUT
    : :
    : : Print @Description
    : : GO
    : :
    : I have a similar issue trying to write a MailItem. Did you ever get a reply or resolve this problem?
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories