Solved

How to import account data from current email client into mine?

Posted on 2004-10-19
3
157 Views
Last Modified: 2010-05-02
Hi,

I'm writing an email client and would like to know how to import account data (friendly name, server name, user name, password...) from existing account(s) into my client.  I've seen this done with other email programs.  Code would be great.

Thanks, QS
0
Comment
Question by:QuantumSingularity
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
jimbobmcgee earned 250 total points
ID: 12357022
A couple of pointers for importing Outlook settings.  The following will take some of the more simple settings (address, name, etc) for the current Outlook user:

    Sub SessionSettings()
   
        Dim myOL As Outlook.Application
       
        Set myOL = New Outlook.Application
       
        With Form1.Text1
           
            'Current User Properties
            .Text = .Text & "CU-Address: " & myOL.Session.CurrentUser.Address & vbCrLf
            .Text = .Text & "CU-AddrEntry: " & myOL.Session.CurrentUser.AddressEntry & vbCrLf
            .Text = .Text & "CU-Class: " & myOL.Session.CurrentUser.Class & vbCrLf
            .Text = .Text & "CU-EntrID: " & myOL.Session.CurrentUser.EntryID & vbCrLf
            .Text = .Text & "CU-Name: " & myOL.Session.CurrentUser.Name & vbCrLf
            .Text = .Text & "CU-Type: " & myOL.Session.CurrentUser.Type & vbCrLf

        End With

        Set myOL = Nothing
           
    End Sub


The following will enumerate the addresses stored in all address lists (for a Contacts item, perhaps):

    Sub Addresses()
   
        Dim myOL As Outlook.Application
        Dim myAL As AddressList
        Dim myAE As AddressEntry
       
        Set myOL = New Outlook.Application
       
        With Form1.Text1
           
            For Each myAL In myOL.Session.AddressLists
               
                .Text = .Text & vbCrLf & myAL.Name & ": (" & myAL.AddressEntries.Count & ")" & vbCrLf
                For Each myAE In myAL.AddressEntries
                   
                   .Text = .Text & vbTab & myAE.Address & vbCrLf
                   
                Next myAE
               
            Next myAL
               
        End With

        Set myOL = Nothing
   
    End Sub


I guess you'd have to do some searching around the Outlook.Application object for the other settings...

HTH.

J.
0
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 12357032
BTW, the above code snippets require a form (Form1) with a text box (Text1), set to Multiline = True, WordWrap = False and ScrollBars ~ Both.

J.
0
 

Author Comment

by:QuantumSingularity
ID: 12362165
jimbob,
Looks promising.  Unfortunately we don't have Outlook on any of our machines to test/expand the code.  I guess I'm more interested if extracting the data from Outlook Express.  Any ideas there?

QS
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question