Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

Determine account using Outlook region and VB.net

I'm trying to determine the user account of a person by way of an Outlook region and vb.net.  In short, someone will be logged into Exchange using Outlook and through a Outlook region form, save information back to my SQL server.  When this info is saved, I need to identify the person saving the record and the best method in this case would be the person logged into Outlook and sending emails.  Any direction on how to begin would be appreciated.

Thanks.
0
TheChos
Asked:
TheChos
  • 3
  • 2
1 Solution
 
David LeeCommented:
Hi, TheChos.

I'm not clear on what you're doing.  I'm assuming that you're talking about a custom Outlook form that's using a region to collect data.  Is that correct?  If so, then the code is running inside of Outlook, meaning you can use Outlook's own object model to find out who the user is.  

session.CurrentUser.Name

Open in new window


returns the name of the current user.
0
 
TheChosAuthor Commented:
That's what I'm looking for but I need a little help regarding the session portion of your answer.  How do I declare/assign that piece?
0
 
David LeeCommented:
I'm not clear on whether your code is in Outlook or is an add-in, running outside of Outlook.  If it's the former, then Session is an existing variable in Outlook.  There's no need to declare it, just reference it.  If the code is running from an add-in, then you likely already have an object that's an instance of Outlook.  If the name of that object were objOutlook, then you'd access Session like this

objOutlook.Session.CurrentUser.Name

Open in new window

0
 
TheChosAuthor Commented:
Worked perfectly.  Thank you!
0
 
David LeeCommented:
You're welcome!
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now