Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Anyone familiar with CDO or WebDAV in VB?

Options
  • 22-10-2008 9:55am
    #1
    Moderators Posts: 51,799 ✭✭✭✭


    Hey everyone, just looking for some help. Having some trouble with sending emails from VB6. Not really experienced with this type of work.


    Working on a project and have to send emails as part of it.
    Managed to do this with CDO and using SMTP. But now the boss wants it to send via Exchange server. To only reason for this seems to be to log the email in the sent items in Exchange.

    I changed the sendUsing parameter to 3 to indicate send using Exchange.
    It now tells me I can't update fields and to check the status. No documentation I found online has given me any clue as to how to track down the problem fields.
          mail.configuration.fields.Item("[URL]http://schemas.microsoft.com/cdo/configuration/sendusing[/URL]") = 3
    

    Then, we came across WebDAV. Wrote some test code to send an email using WebDAV.
      Set xmlReq = CreateObject("Msxml2.xmlhttp")
      
      xmlReq.Open "PUT", strTempURI, False, strUserName, strPassWord
      
      
      xmlReq.send strText
    
    It seems that form based authentication is stopping me from getting this working. Once again, cannot find any help for how to use this in VB.

    Another solution if possible, could be to use the SMTP/CDO code that is working and just include some code to log it to exchange.

    I really don't know if I'm asking for something that is possible.

    Thanks for any help

    If you can read this, you're too close!



Comments

  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Re WebDAV its not natively enabled via IIS 6.0 so follow these instructions to get it going http://www.windowsnetworking.com/articles_tutorials/WebDAV-IIS.html

    If you have it already working, you can pop the files to a temporary filestore using anon auth and then reference them from your code easily enough...


  • Moderators Posts: 51,799 ✭✭✭✭Delirium


    Ginger wrote: »
    Re WebDAV its not natively enabled via IIS 6.0 so follow these instructions to get it going http://www.windowsnetworking.com/articles_tutorials/WebDAV-IIS.html

    If you have it already working, you can pop the files to a temporary filestore using anon auth and then reference them from your code easily enough...
    Thanks for that, ginger.

    Okay, did that and put together a simple procedure to send an email with no attachment via exchange using WebDAV. Am currently getting Permission denied when I run the send command of the MSXML.XMLHTTPRequest object.

    Am using VB6 on an XP client trying to do this with our server running exchange server 2003.

    If you can read this, you're too close!



  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Make sure your directory has permissions to for the ISUR account

    Now this is where it gets tricky

    Are you using a folder with anon auth(or vdir within an existing vdir) or a brand new virtual directory at the top level of iis for this

    There is a couple of issues with WebDav and killbits in IE as well you need to reeable something for it.. cant remember off the top of my head


  • Moderators Posts: 51,799 ✭✭✭✭Delirium


    Ginger wrote: »
    Make sure your directory has permissions to for the ISUR account
    I'm using the administrator user for testing.
    Now this is where it gets tricky

    Are you using a folder with anon auth(or vdir within an existing vdir) or a brand new virtual directory at the top level of iis for this

    There is a couple of issues with WebDav and killbits in IE as well you need to reeable something for it.. cant remember off the top of my head
    The mailbox folder I'm linking to is basically default settings on it AFAIK.

    When I use Outlook Web Access to the exchange mailbox all my settings work.

    However, in my VB application the same settings (of the ones I know of so far) gives me a permissions denied warning.

    Any documents on the web I've found have referred to form based authenication.

    If you can read this, you're too close!



  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Fairly sure your VB App is not impersonating your user.

    What I was saying to do was check WebDav was working on a brand new site to see if you can see if its functioning correctly and establish your code is correct etc.

    Silly question have you looked at this code sample

    http://www.devarticles.com/c/a/Visual-Basic/Fun-with-Email-VB6-CDO-MAPI/1/


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭Ginger




  • Moderators Posts: 51,799 ✭✭✭✭Delirium


    Ginger wrote: »
    Fairly sure your VB App is not impersonating your user.

    What I was saying to do was check WebDav was working on a brand new site to see if you can see if its functioning correctly and establish your code is correct etc.

    Silly question have you looked at this code sample

    http://www.devarticles.com/c/a/Visual-Basic/Fun-with-Email-VB6-CDO-MAPI/1/
    Not a silly question, seeing as it is very different from the code I've used. Will give that a shot and you know.
    Thanks for all the help.:)

    If you can read this, you're too close!



  • Moderators Posts: 51,799 ✭✭✭✭Delirium


    Gave that code a try. MAPI, isn't a good solution as the outlook prompts appear on each message.
    CDO is what we have been trying to use but can't find any documentation that is comprehensive enough regarding Exchange Server. It is a step in the right direction because it removes the outlook prompts from the equation.

    If you can read this, you're too close!



  • Registered Users Posts: 2,931 ✭✭✭Ginger


    That is the problem with using Outlook since XP version and they added that safety check

    Anyways, have a look at CDOEX which is CDO for Exchange....

    http://kbalertz.com/314383/CDOEX-Library-retrieve-messages-Inbox-using-Visual-Basic.aspx

    That is a VB.NET example but gives you an idea...

    And you are probably using this

    http://support.microsoft.com/kb/248687


Advertisement