programming username of editor into custom form

A

AmyG

Im using Outlook XP with a Microsoft Exchange server.
I've created a custom contact form which is available in
the Public Folders to all users on the network.
The form has a "Date Modified" field which is
programatically modified to the current date every time a
contact is edited and saved. Is it possible to add a
field that automatically enters the username of the person
who edited it?

Thanks,
Amy
 
K

Ken Slovak - [MVP - Outlook]

NameSpace.CurrentUser will give you that but it will fire the security
prompts unless you permit that property in the Exchange security form
or use Redemption or Extended MAPI. If you are using Redemption you
can use its SafeCurrentUser object.

An alternative is to get the mailbox name using
NameSpace.GetDefaultFolder(olFolderInbox).Parent.Name. That would give
you a string in the form of "Mailbox - user name". You can then use
the StrRev function to find the "-" character and strip out it and
everything to its left from the string. Then strip off any starting
and ending spaces and you have the current user name.
 
A

amyg

Thanks. The latter option sounds like it would be best.
I'm fairly novice at this programming though, any chance
you can help me out with the code?
Thanks,
Amy
 
K

Ken Slovak - [MVP - Outlook]

The code would look something like this:

Dim strMailbox
Dim strUser

strMailbox = Application.Session.GetDefaultFolder(6).Parent.Name
'Inbox=6
gstrUser = Trim(Right(strMailbox, Len(strMailbox) -
InStrRev(strMailbox, "-")))
 

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