Solved

VB Script in Outlook 2010 user name

Posted on 2014-02-05
2
404 Views
Last Modified: 2014-02-05
Hello,

Currently, I programatically get the user name from the Outlook 2003 Mailbox like this:

  t = oNS.GetDefaultFolder(6).Parent.Name '6=olFolderInbox Parent = MailBox Folder Name
  If Left(t, 7) = "E-mail " Then t = Trim(Mid(t, 8))
  If Left(t, 8) = "Mailbox" Then t = Trim(Mid(t, 8))
' t = Mid(t, Instr(t, "-") + 1)     'Parse out the user's name from the Mailbox Folder Name
  iPos = 0: iPos = InstrRev(t, "-")
  If iPos > 0 Then
    t = Mid(t, iPos + 1)    'Parse out the user's name from the Mailbox Folder Name
  End If
  t = Replace(t, "[","")
  t = Replace(t, "]","")
  t = Trim(t)

This code would return something like "John Smith".  However, since upgrading to Outlook 2010, it returns this: "johns@abc.com".  I need to find another field name or something to get the actual users name.

Thanks,
Joel
0
Comment
Question by:Genius123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 39836474
Hi Joel,

What about using the namespace's session name directly?
MsgBox oNS.Session.CurrentUser

Open in new window

Matt
0
 

Author Closing Comment

by:Genius123
ID: 39836731
Brilliant!  That worked!  Thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

690 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