Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB 5.0 Outlook application

Status
Not open for further replies.

rkckjk

IS-IT--Management
Apr 27, 2001
34
US
I currently have a VB 5.0 application that uses Outlook 97 on a PC running Windows XP. I'm trying to pull off the CurrentUser from the Outlook object and display it in a txtbox in my VB application. I was told that MAPI is unavailable with Windows XP and that you have to use CDO. Is this true? If so, how would you get the CurrentUser from Outlook 97? Here is a piece of VB I put together real quick to get the CurrentUser from Outlook:

Public Function OutlookUser() As String

Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim strUser As String

Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")

strUser = nms.CurrentUser

Debug.Print "Outlook User Name: " & strUser
objOutlook.Quit

End Function

Will the above code work with Windows XP or how would you do it with CDO?

Thanks
 
Your code appears to work OK in VB6 under XP Pro with Outlook 2002


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
I believe that in OL2002 Internet Only Mode, MS broke the part of MAPI that returns the CurrentUser. Still works OK in Corporate/Workgroup mode. Not been fixed yet afaik.

Paul Bent
Northwind IT Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top