Outlook Script: How to get the FirstName of the current User

B

bbnimda

Hi all,

I'm looking for a way to get the Firstname of the currentUser, but I didn't
find, if someone can help it will be great

here the code I'm using nox, it give me The full Name of the user

AddUsr = application.GetNameSpace("MAPI").CurrentUser

tks
 
S

Sue Mosher [MVP-Outlook]

Apply a little simple text parsing:

firstName = Left(AddUsr, Instr(AddUser, " ") -1)
 
B

bbnimda

Hi Sue,

I allready tryed that, but some of them have composed Name and firstname and
in this case I just obtain a part of the FirstName

here's an example "Jean Michel De La Laurencie"

where the First Name is "Jean Michel"
and the Name " De La Laurencie"

is there another way ?


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
Apply a little simple text parsing:

firstName = Left(AddUsr, Instr(AddUser, " ") -1)
 
S

Sue Mosher [MVP-Outlook]

Not enough information to say. We don't know your OUtlook version or whether users have Exchange mailboxes or POP3 accounts.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
Hi Sue,

I allready tryed that, but some of them have composed Name and firstname and
in this case I just obtain a part of the FirstName

here's an example "Jean Michel De La Laurencie"

where the First Name is "Jean Michel"
and the Name " De La Laurencie"

is there another way ?


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
Apply a little simple text parsing:

firstName = Left(AddUsr, Instr(AddUser, " ") -1)
 
B

bbnimda

I'm using outlook 2003 / Exchange 2003

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
Not enough information to say. We don't know your OUtlook version or whether
users have Exchange mailboxes or POP3 accounts.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
Hi Sue,

I allready tryed that, but some of them have composed Name and firstname
and
in this case I just obtain a part of the FirstName

here's an example "Jean Michel De La Laurencie"

where the First Name is "Jean Michel"
and the Name " De La Laurencie"

is there another way ?


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message
de news: (e-mail address removed)...
Apply a little simple text parsing:

firstName = Left(AddUsr, Instr(AddUser, " ") -1)
 
S

Sue Mosher [MVP-Outlook]

In that case, what you want to do cannot be done with the Outlook object model. You'd need to use a low-level API such as CDO 1.21 or, to avoid security prompts, Redemption, to get the AddressEntry object representing the current user and access the PR_GIVEN_NAME (&H3A06001E) MAPI property through the Fields collection. The page at http://www.cdolive.com/cdo10.htm is a good primer on working with MAPI properties.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


bbnimda said:
I'm using outlook 2003 / Exchange 2003

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
Not enough information to say. We don't know your OUtlook version or whether
users have Exchange mailboxes or POP3 accounts.

bbnimda said:
Hi Sue,

I allready tryed that, but some of them have composed Name and firstname
and
in this case I just obtain a part of the FirstName

here's an example "Jean Michel De La Laurencie"

where the First Name is "Jean Michel"
and the Name " De La Laurencie"

is there another way ?


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message
de news: (e-mail address removed)...
Apply a little simple text parsing:

firstName = Left(AddUsr, Instr(AddUser, " ") -1)

bbnimda said:
Hi all,

I'm looking for a way to get the Firstname of the currentUser, but I
didn't
find, if someone can help it will be great

here the code I'm using nox, it give me The full Name of the user

AddUsr = application.GetNameSpace("MAPI").CurrentUser
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top