public User[] GetAllUsers() |
I need to get the user who currently logged in to the client.
could anyone provide a sample code on this please.
I tried to get the security header value but it doesnt work.
Solved! Go to Solution.
Solved by UweHandzik. Go to Solution.
Solved by Redmond.D. Go to Solution.
From the Connection object, you can just read the UserName property.
Just incase if some one needs this.
I was using a WPF window and it is different from the samples which are still in winfoms where the static main is manually altered where as in wpf its autogenerated, even editing it manually will not work.
Here is the work flow for wpf devs (Check static main in wpf in google to understand how to have ur own static main in wpf)
in App.Xamls.cs
[STAThread] static void Main() { App app = new App(); VDF.Vault.Forms.Settings.LoginSettings settings = new VDF.Vault.Forms.Settings.LoginSettings(); VDF.Vault.Currency.Connections.Connection connection = VDF.Vault.Forms.Library.Login(settings); if (connection == null) return; MainWindow window = new MainWindow(connection); app.Run(window); VDF.Vault.Library.ConnectionManager.LogOut(connection); }
In App.g.cs
VaultWinApp.App app = new VaultWinApp.App(); app.InitializeComponent(); app.Run();
In mainWindow
have the following to store the connection and that can be used locally
private VDF.Vault.Currency.Connections.Connection m_connection;
Now access the userId, Username and other connection object as follows
m_connection.UserID.ToString() m_connection.UserName.ToString();
Hope it helps someone.
Using the connection object to get the user name only works when you are NOT using the windows authentication login.
If using the WA you can use
dim strUserName As String = Environ("Username")
Hello,
so you say, that there is no API to read email logged User?
I'm logged user and I'm not able read my own mail by Vault API???
Seriously?
Hello,
Your get the UserId for Example
Public Enum eGetUser
Mail
Name
End Enum
....
Dim allVltUsers As Autodesk.Connectivity.WebServices.User() = Autodesk.Connectivity.WebServices.AdminService.GetAllUsers()
For Each myUser As ACW.User In allVltUsers
If myUser.Id.ToString = cUserId Then
Select Case eArt
Case eGetUser.Mail : Return myUser.Email
Case eGetUser.Name : Return myUser.Name
End Select
End If
Next
So you can get any Information from the User ...