Get full name of user from Active directory

JEyton
Member Posts: 33
Hi!
How do I get the full name of the user in NAV? The USERID gives me only the users loginname and I want the full name.
Anyone have any idea?
How do I get the full name of the user in NAV? The USERID gives me only the users loginname and I want the full name.
Anyone have any idea?
0
Answers
-
NAV - Norton Anti Virus
ERP Consultant (not just Navision) & Navision challenger0 -
Hi again
Thanks for the link.
I tried the automation 'Windows Script Host Object Model'.WshNetwork but none of functions worked for me. I only get the login name and not the name of the user.
The ENVIRON function (for example environ('Username') gave me only the loginname aswell.
Is there anything I have missed?
](*,)0 -
message(environ('Userdomain')+'/'+environ('Username')); or message(environ('USERDNSDOMAIN')+'/'+environ('Username'));
is not enough :?:
What do you need also :?:
RegardsDo you make it right, it works too!0 -
I need the name and not the id (username) of user. For exampel the username for a user is DOMAIN\TJONES and his full name is Tom Jones.
In the form "Windows users & groups" i want the column Name and not the ID0 -
ah ok you need to read the AD. No problem. I would post here the whole solution, but i'm at home and here is no AD to test :-( . So, lets start with theory. You must only know the DC and domain (thats no problem).
You can solve this for example with an vbs script with return parameter. This script your call from NAV and you read the returnvalue. The other method is, let check my brain, it think it was ADO. Because since Win2000 you can fire up sql commands to the machine :-)
so, with ADO and provider = (i hope its the true name) "ADsDSOObject"
you can fire up "SELECT * FROM [url=LDAP://dc=YourDomainName]LDAP://dc=YourDomainName[/url] WHERE objectClass = 'user' and objectCategory = 'person' and uid = 'Angela Merkel' ".
Also possible:
check the automation: "Active DS Type Library"
So, test one or both (theory) solutions.
If you need a example, if you doesn't find the solution, lets us know.
RegardsDo you make it right, it works too!0 -
ah, forgotten. If you only need the Name (and not the other fields in you Ou) you can also use the table "Windows Object".
these table contains the following coloumns:GUID ID Name Type SID Distinguished Name
If you need more / other fields, then LDAP://
Regards.Do you make it right, it works too!0 -
Hi Garak!
Thanks for the information and the good examples.
I am trying to get the Name from the table "windows object" but I cant get it to work. The key to the table is "GUID" and I dont have that value.
Also when i am trying to set a filter to the table and use FIND to retrieve the value I only get error messages.0 -
WindowsObject.reset; WindowsObject.setfilter(ID,environ('Username')); if WindowsObject.findset(false) then begin repeat message(WindowsObject.Name + ' / ' + WindowsObject."Distinguished Name"); until WindowsObject.next = 0; end;
doesn't work?Do you make it right, it works too!0 -
Thank you very much! Works like a charm...
Kind regards!0 -
Please, you're welcome
So, please write [Solved] infront of the subject in your first post.
RegardsDo you make it right, it works too!0 -
Actual solution for OBJECT Codeunit 418 Login Management:
PROCEDURE GetUserName@1100520000(UserID@1100520001 : Code[20]) : Text[250];
VAR
User@1100520003 : Record 2000000002;
WindowsLogin@1100520004 : Record 2000000054;
WindowsObject@1100520000 : Record 2000000050;
BEGIN
IF UserID <> '' THEN
IF User.GET(UserID) THEN
EXIT(User.Name)
ELSE BEGIN
WindowsLogin.SETFILTER(ID,STRSUBSTNO('@*%1',UserID));
IF WindowsLogin.FINDFIRST THEN BEGIN
WindowsObject.SETRANGE(SID,WindowsLogin.SID);
IF WindowsObject.FINDFIRST THEN
EXIT(WindowsObject.Name);
END;
END;
END;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions