(SQL Server) Demonstrates how to call AddPfxSourceData for an Email Object
Demonstrates how to call AddPfxSourceData for an Email Object
// Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
//
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @fac int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.FileAccess', @fac OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
EXEC sp_OAMethod @fac, 'ReadEntireFile', @pfxBytes OUT, 'qa_data/pfx/some.pfx'
DECLARE @email int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Email', @email OUT
DECLARE @success int
EXEC sp_OAMethod @email, 'AddPfxSourceData', @success OUT, @pfxBytes, 'PFX_PASSWORD'
IF @success <> 1
BEGIN
EXEC sp_OAGetProperty @email, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @fac
EXEC @hr = sp_OADestroy @email
RETURN
END
PRINT 'Success.'
EXEC @hr = sp_OADestroy @fac
EXEC @hr = sp_OADestroy @email
END
GO
|