to refresh the label on your Form just use Control.Invoke Method like :
this.lbUserAccount.BeginInvoke((MethodInvoker) delegate() {this.lbUserAccount.Text = ComVar.otlConnector.AccountLogged; });
the follwoing solution is part of my code that working fine for my needs
using Outlook = Microsoft.Office.Interop.Outlook;
.
.
.
public string AccountLogged
{
get
{
return GetDefaultOutlookAccount();
}
}
private string GetDefaultOutlookAccount()
{
Outlook.NameSpace session = null;
Outlook.Application outlookApp = GetOutlookApplicationObject(out session);
if (session == null)
return null;
string account = string.Empty;
try
{
Outlook.AddressEntry addrEntry = session.CurrentUser.AddressEntry;
if (addrEntry.Type == "EX")
{
Outlook.ExchangeUser manager = session.CurrentUser.AddressEntry.GetExchangeUser();
if (manager != null)
account = manager.PrimarySmtpAddress;
}
else
{
account = session.CurrentUser.Address;
}
}
catch (Exception ex)
{
}
return account.ToLower();
}
private Outlook.Application GetOutlookApplicationObject(out Outlook.NameSpace session)
{
Outlook.Application app = null;
session = null;
if (Process.GetProcessesByName("OUTLOOK").Length > 0)
{
try
{
app = (Outlook.Application)Marshal.GetActiveObject("Outlook.Application");
session = app.Session;
}
catch (Exception ex)
{
}
}
if (app == null)
{
try
{
app = new Outlook.Application();
session = app.GetNamespace("MAPI");
session.Logon("", "", Missing.Value, Missing.Value);
}
catch (Exception ex)
{
}
}
if (app != null && app.Session != null && session.CurrentUser != null)
session.CurrentUser.Resolve();
return app;
}