CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 3070

CAD tip CAD tip # 10889:

   
Question CAD 
 %  platform  category 
Q - question

How to get user's full domain name, phone No., department, e-mail...

A - answer AutoCAD, LT, Inventor, Revit and other applications allow to easily get information about the login name of the current user - e.g. for using in title blocks or in various filing ad-ons. But if you need more information about the currently logged-in user (e.g. his/her full name) to automatically fill-in drawing texts or project parameters, the situation gets more complex.

In AutoCAD, you can get the full "display name" using the dynamic text field with the variable "Login" - the field code:

%<\AcVar Login \f "%tc4">%

entered in a text or attribute value will display the full user name:

If you want to access full username in your own add-on application or script, maybe including more details from the domain record (LDAP, Directory Services), you can use - on computers logged into a company domain - the respective functions available in VBA or .NET tools; for LISP you can use the CAD Studio's utility (getuserinfo). This utility returns the list with detailed information (name, e-mail, city, mobile phone number, company, department, job title) about the current domain user - e.g.:

("John Doe" "john.doe@acme.com" "New York" "+001 800 123 456" "ACME Inc." "Development" "CAD Manager")

Then e.g. calling "(nth 1 (getuserinfo))" will return the e-mail address. Contact CAD Studio for the source code of the getuserinfo utility.

To get the full domain name of the user (DisplayName) or his/her phone number e.g. in Inventor, use the following code of an iLogic rule:

'This must be in the rule header
AddReference "System.DirectoryServices.AccountManagement.dll"

Dim displayName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName
MsgBox(displayName)
Dim Phone = System.DirectoryServices.AccountManagement.UserPrincipal.Current.VoiceTelephoneNumber
MsgBox(Phone)

Obviously, the condition is that the user must be logged into the domain (and not just e.g. a local account on the home computer).

ACADInv
100% *  CAD 
6.5.2016    10618×  
Prices - CAD eShop:
applies to: AutoCAD · Inventor ·

See also:
Tip 13917:Check for concurrently running named licenses (device limit).
Tip 13641:How do I restore an accidentally deleted file in Fusion 360?
Tip 13348:Holixa License Management: assign license to a user
Tip 13342:How to download the latest version of installation media for Holixa applications
Tip 13334:How to recover forgotten login password on the Holixa Licensor?


Back   All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Use Google Earth images in your AutoCAD projects with the Plex.Earth Tools More info


Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist