programming username of editor into custom form

  • Thread starter Thread starter AmyG
  • Start date Start date
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
 
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.
 
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
 
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, "-")))
 
Back
Top