Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sp_OAMethod send

Status
Not open for further replies.

foxbox

Programmer
Sep 11, 2000
1,052
NL
I'm trying to create MS Exchange appointment via a trigger.

The following ASP code is working A-oke:
Code:
strApptURL = "[URL unfurl="true"]http://"[/URL] & strExchSvrName & "/exchange/test/Calendar/testappointment.eml"
strApptRequest = "<?xml version=""1.0""?>" & _
 "<g:propertyupdate " & strXMLNSInfo & _
  "<g:set><g:prop>" & _
    "<g:contentclass>urn:content-classes:appointment</g:contentclass>" & _
    "<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>" & _
    strMailInfo & _
    strCalInfo & _
    "<header:to>" & strMailbox & "</header:to>" &_
    "<mapi:finvited dt:dt=""boolean"">1</mapi:finvited>" & _
   "</g:prop></g:set>" & _
 "</g:propertyupdate>"

set xmlReq = CreateObject("Microsoft.XMLHTTP")
xmlReq.open "PROPPATCH", strApptURL, False, strUserName, strPassword
xmlReq.setRequestHeader "Content-Type", "text/xml"
xmlReq.send strApptRequest
set xmlReq = Nothing

(of course the string variables are all set before this code)


So, then i changed it into T-SQL:

Code:
declare @ObjectID int
Exec sp_OACreate 'Microsoft.XMLHTTP', @ObjectID OUT

Exec sp_OAMethod @ObjectID, 'open', NULL, 'PROPPATCH', @strApptURL, false, @USERID, @PASSWORD

Exec sp_OAMethod @ObjectID, 'setRequestHeader', NULL, 'Content-Length', 'text/xml'

Exec sp_OAMethod @ObjectID, 'setRequestHeader', NULL, 'Depth', '0'

Exec sp_OAMethod @ObjectID, 'send',@strApptRequest

Exec sp_OADestroy @ObjectID


This works UNTIL the 'send' line. Somehow i'm calling with incorrect parameters there:

"ODSOLE Extended Procedure sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]"

It looks like i must do this:
Exec sp_OAMethod @ObjectID, 'send'

but how do i tell to send @strApptRequest???? or what am i missing on the send line?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top