Results 1 to 7 of 7

Thread: Outlook Automation error

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    8

    Outlook Automation error

    Hi,

    Do I need Exchange server installed in my machine for the CDO objects to work properly? I dont have exchange installed in my machine. So when I tryrunning a code for displaying the outlook adress book from Vb using CDO 1.2 Library, I get the error "This program has performed Illegal operation". This closes the VB app itself.
    Any thought?

    Thanx
    Sandeep

  2. #2
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Did you try to debug your program prior to asking this question? You must - there is no way arround. See what exactly is giving you a problem (or perhaps what you are doing wrong).

    Roy

  3. #3
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    It should work with outlook, try the following


    You could try to add a component to your form
    goto Project Components and add a mark next to Microsoft MAPI controls 6.0

    Add a MAPPISession control to your form and a MAPPIMessages control .

    Then try to use them into your code.

    rename them appropriate.

    Don't you have to use oSession.SignOn
    instead of oSession.Logon "", "", False, False
    Hope this helps
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    8

    Outlook Automation Error

    Hi,


    Thanx a lot Swatty n Roy.

    I'm creating a wrapper over CDO, so I cant use a component here. I would rather use CDO objects to achieve the same.

    Even when I write a simple code, I get the error "This program has performed illegal operation"

    The following code snippet generates the error I specified above.

    Private Sub Command1_Click()

    Dim oSession As MAPI.Session

    Set oSession = New MAPI.Session
    oSession.Logon "", "", False, False


    msgbox oSession.CurrentUser

    End Sub


    Strangely I get this error only with some methods or properties. Also when I use the code to display address book I get the same error.

    ie. oSession.Adressbook generate the same error.

    Sandeep

  5. #5
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    sandeep,
    as swatty mentioned you may better use MAPI controls then explicitely declare an object variable. The problem could probably be that you may have MAPI related dll corrupted or outdated. See if this helps.

    Roy

  6. #6
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Or perhaps use MS Outlook x.x object type library to create an e-mail app.

    Cheers, Roy

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    8

    :(

    Since I'm asked to develop it using CDO, i cant opt for outlook object model. I tried the same code in 2 different machines and I'm getting the same error. On 1 machine OS is XP pro and on the other it is Win 2k . When I keep the mouse poniter over the dl it gives the description CDO for 95 and NT. Will that be a problem?
    Sandeep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width