Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / September 2003

Tip: Looking for answers? Try searching our database.

Current User capture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RJ - 18 Sep 2003 00:23 GMT
I am trying to capture the userid of an outlook user with
the following code:

'Get data from Session.CurrentUser.
 Dim cdoSession 'As MAPI.Session
 Dim cdoAddrEntry 'As AddressEntry
 Dim strUsername 'as string

'Define them explicitly or use their value.
 dim cdoPR_Account
 dim cdoPR_EntryID
 Dim vbCRLF

 cdoPR_Account = &h3a00001e
 cdoPR_EntryID = &h0fff0102
 vbCRLF = chr(13) & chr(10)

 on error resume next

'Start the CDO code to find a match.
 Set cdoSession = CreateObject("Mapi.session")
 cdoSession.Logon ,,false,false,0  
 if err.number <> 0 then msgbox "ERROR in logon: " &
err.number & vbCRLF & err.description

'Get the AddressEntry of the recipient/current user.
 Set cdoAddrEntry = cdoSession.CurrentUser
 if err.number <> 0 then msgbox "ERROR getting
AddressEntry: " & err.number & vbCRLF & err.description

'Get properties.
 strUsername = cdoAddrEntry.fields(cdoPR_Account)

objUsername.value = strUsername
 
'Explicitly release objects.
cdoSession.logoff
Set cdoAddrEntry = Nothing
Set cdoSession = Nothing

When I test the code on my computer it works just fine,
however, when I go over to a colleague's computer and try
it on there, I get the error messages in the code above.  

The same version of OL2K is used so I don't see a problem
there.  Can it be that only one login can be used at a
time?  Please help (if you can?).

Thanks
Patricia Cardoza - [MVP Outlook] - 18 Sep 2003 00:45 GMT
What error message? CDO isn't installed by default in all versions of
Outlook so it might be that your user's computer doesn't have it installed.
Run Add/Remove Programs and select Outlook. Then you should be able to add
CDO.

Signature

Patricia Cardoza
Outlook MVP

Author, Special Edition Using Microsoft Outlook 2003

***Please post all replies to the newsgroups***

> I am trying to capture the userid of an outlook user with
> the following code:
[quoted text clipped - 45 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.