Connection with an SQL Server 2005 database

MS OFFICE OUTLOOK

    Next

  • 1. Delete duplicate mails
    Hi All, I have many messages which are replies of previous messages. I want keep the latest one only and delete all previous messages. This activity is to be doe for only one folder and not for other folders. Is it possible? Thank You, Regards, Pawan
  • 2. Problem writing Body property to a new Contact
    Hi, all! Trying to locate an answer as to why attempts to write info to the .Body property of the ContactItem object (CreateItem method) is failing... Code follows: Dim oCT As Outlook.ContactItem = oApp.CreateItem(Outlook.OlItemType.olContactItem) With sttUser If .strFullName <> "" Then oCT.FullName = .strFullName If .strFirstName <> "" Then oCT.FirstName = .strFirstName If .strNote <> "" Then oCT.Body = .strNote If .strTitle <> "" Then oCT.Title = .strTitle ' Lines removed for brevity oCT.Save() End With "sttUser" is a structure that contains data imported from another contact manager application; some lines have been deleted to save bandwidth. There are no errors thrown during the Save operation, and all data (except .Body) are written correctly. I know the variable contains good data because I can write the same information to other text fields (such as the User Defined fields in the Contact object) without a problem. It's just the .Body property that refuses to accept data. Thoughts? Thanks! Jack
  • 3. Express ClickYes Problem
    Hi all, I've been using the Express ClickYes program very happily for some time now so when my latest project needed to be able to automatically send emails I thought it would be easy to do. Unfortunately there is one big difference between the latest project and the earlier ways I was using ClickYes. This time around the Access VBA program runs uninterupted and as such after a while the machine which this runs on locks itself. I've just read that ClickYes doesn't work when the machine is locked and I'm guessing that this is what's causing all my problems at present. I'm using Access 97 on NT4 in a corporate environment - hence no way to stop the machine from locking. Can anyone confirm that ClickYes works in this way and if so has anyone found a work around? Seems a shame that such a good program has an achilies heel of the machine locking. Thanks in advance for any replies, Brad
  • 4. Changing date in Journal with keyboard strokes
    Can someone direct me toward the VBA code for changing the date in the journal by pressing the or key on the keyboard? Thanks

Connection with an SQL Server 2005 database

Postby RosH » Fri, 06 Apr 2007 01:10:18 GMT

I would like to create a macro when triggered at the definition of a
rule in Outlook would read the properties of the new email and update
a SQL Server 2005 database through a database connection.  For example
I would like to store and append all the sender names and the subject
field of ruled out emails into a database which is already defined.
Which classes should I be using to achieve this and what will be the
procedure?

Thank you in advance.


RE: Connection with an SQL Server 2005 database

Postby RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ » Fri, 06 Apr 2007 04:06:01 GMT

See this KB article on how to wire up a macro to a rule:

How to create a script for the Rules Wizard in Outlook: 
 http://www.**--****.com/ ;en-us;q306108

Aside from that, all the database plumbing is up to you.  The event that you 
wire above gives you the MailItem object so you have access to its 
properties.  For more resources on database integration with Outlook, see 
this page:

Connecting Outlook and Exchange to Databases: 
 http://www.**--****.com/ 

-- 
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook: 
 http://www.**--****.com/ 
Blog:  http://www.**--****.com/ 






Re: Connection with an SQL Server 2005 database

Postby RosH » Fri, 06 Apr 2007 20:43:31 GMT

Thank you very much Eric for the references.  I was able to build the
code myself.  But unfortunately errors keep on following me. I have
included the code and the error below.  I would appreciate you to
comment on it.

Error-----------------
Multiple-Step OLE DB operation generated errors.  Check each OLE DB
status value, if available.  No work was done.

Code----------------------

Sub RosHConnectSQL()
    Dim Dbcon As New ADODB.Connection
    Dim Dbcom As New ADODB.Command
    Dim DbRs As New ADODB.Recordset

    Dbcon.ConnectionString = "Data Source=.
\SQLEXPRESS;AttachDbFilename=""C:\Documents and Settings\Administrator
\My Documents\Website.mdf"";Integrated Security=True;Connect
Timeout=30;User Instance=True"

    Dbcon.Open
    Dbcom.ActiveConnection = Dbcon
    Dbcom.CommandText = "Select StatusID from Status"
    Set DbRs = Dbcom.Execute
    MsgBox DbRs(0)

    DbRs.Close
    Dbcon.Close


End Sub


Re: Connection with an SQL Server 2005 database

Postby RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ » Fri, 06 Apr 2007 23:48:03 GMT

I'd be more than happy to help you with Outlook related questions, but for 
SQL stuff please post in the appropriate newsgroup.  I don't see anything 
wrong with your code that's immediately apparent.

-- 
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook: 
 http://www.**--****.com/ 
Blog:  http://www.**--****.com/ 








Return to MS OFFICE OUTLOOK

 

Who is online

Users browsing this forum: No registered users and 84 guest