My.user.name Blank in outlook add-in

Add-in Express™ Support Service
That's what is more important than anything else

My.user.name Blank in outlook add-in
Can not get user name for dot.net 2.0 my statment in outlook addin 
martin ratcliffe




Posts: 15
Joined: 2006-08-17
I have an addin which tracks users emails for attachment to a document management system. I am trying to pull the domain user details to add to the database using my.user.name but it comes up blank in the add-in for outlook although this same line returns the correct information from a standard windows form

Is this an issue with outlook or the add-in as i desperatly need to know the person who is logged on to track the documents.
Posted 21 Sep, 2006 06:43:13 Top
Matt Driver


Matt


Posts: 152
Joined: 2004-08-17
I use in C# .net 2:

//returns "i2limited\eura006" so parse to just return eura006
adloginname = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToUpper();
int slashindex = adloginname.IndexOf(@"\");
adloginname = adloginname.Substring(slashindex + 1, adloginname.Length - slashindex - 1);

it strips out the domain and leaves just the user name as adloginname.

Hope it helps
Matt
Posted 21 Sep, 2006 06:46:51 Top
martin ratcliffe




Posts: 15
Joined: 2006-08-17
Thanks Matt that works fine.

Just strange that the my.user.name function does not work from the addin but thanks for the help
Posted 21 Sep, 2006 07:11:16 Top