Solved

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

Posted on 2004-10-19
3
155 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now