Solved

Determine account using Outlook region and VB.net

Posted on 2014-01-08
5
481 Views
Last Modified: 2014-01-16
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
Comment
Question by:TheChos
[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
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 39770666
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
 

Author Comment

by:TheChos
ID: 39770758
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
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 39770980
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
 

Author Closing Comment

by:TheChos
ID: 39785725
Worked perfectly.  Thank you!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 39786322
You're welcome!
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

740 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