views:

854

answers:

1

I know that the name of the user account can be retrieved from the built in variable User!UserID but how can I get the full user name of the user?

I guess it would be possible to hook up some .NET code and do a Active Directory look up but are there any alternatives?

+2  A: 

In one of my projects I used a table in SQL Server to store the user data from Active Directory ("displayName", "sAMAccountName", "userPrincipalName"), using a C# application for data transfer. The table was updated nightly and also after any change in Active Directory which could impact my project users.

In my case (Infopath form hosted on Sharepoint) I was using an web service to get the account name of the current user from Sharepoint, in order to display the coresponding user full name.

alexandrul
That would work but I'm looking for other solutions as well. Maybe it is possible to set up an Active Directory data source. Will have to look into that.
Manga Lee
You could try to set an web service to return the desired data for the specified account, but I could not find an easy way to call the web service from SQL Server. And I did not find out how to set the Active Directory as a linked server, so I just used a table as a cache for the user information.
alexandrul