Having trouble with this script

  • I am having trouble getting this script working in my ActiveX task:

    Dim iConf As New CDO.Configuration

    Dim Flds As ADODB.Fields

    Set Flds = iConf.Fields

    Flds(cdoLanguageCode) = "en-us"

    Flds(CDO.cdoTimeZoneIDURN) = cdoMountain

    Flds.Update

    Dim iMsg As New CDO.Message

    Set iMsg.Configuration = iConf

    What I am trying to do is set the time zone for the message. All of the messages that my server generates through CDO are an hour off. Here is what I have so far, but it generates an error on the 2nd and 3rd Set Flds. commands.

    Dim iConf

    Set iConf = CreateObject("CDO.Configuration")

    Dim Flds

    Set Flds = iConf.Fields

    Set Flds.cdoLanguageCode = "en-us"

    Set Flds.cdoTimeZoneIDURN = 11

    ' 11 is value for Central time

    Flds.Update

    Dim objMail

    Set objMail = CreateObject("CDO.Message")

    Set objMail.Configuration = iConf

    objMail.From = " email address goes here"

    objMail.To = "my email address goes here"

    objMail.Subject="Email from Server"

    objMail.TextBody = "This was sent from a DTS job on Server"

    objMail.Send

    Set objMail = nothing

    Main = DTSTaskExecResult_Success

    End Function

    Thanks in advance for any responses to this post.


    Live to Throw
    Throw to Live
    Will Summers

  • What is the error message?

     

    K. Brian Kelley
    @kbriankelley

  • Object doesn't suppport this property or method:'Flds.cdoTimeZoneIDURN'

    I assume that this is because I'm not defining the ADODB.Fields. I tried to do that with a createobject, but it didn't work. Since VB changes variable types on the fly and you don't have to cast them, I figured that I could just skip that step since I am setting the variable right after I declare it.


    Live to Throw
    Throw to Live
    Will Summers

  • I also get a similar error with the line above that one:

    Object doesn't suppport this property or method:'cdoLanguageCode'


    Live to Throw
    Throw to Live
    Will Summers

  • I'm assuming you've tested it as a vbscript script on the server to see if you are getting the same error. The only thing I can think of is an older version of the component which doesn't support those properties is installed. However, according to the MSDN docs this was part of Windows 2000 and already registered. So I'm left scratching my head.

     

    K. Brian Kelley
    @kbriankelley

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply