Can someone help me with a SQL query or a piece of code to extract all the list of Groups in my Windchill Instance and the associated users in every group. I couldn't find a straightforward API that can be used to query this and get it out.
Thanks in advance!
Group and group member information is stored in LDAP, so a DB query is not an option. You can get the group either using a QuerySpec or by using OrganizationHelper.
To get the members, OrganizationServicesHelper.manager.members((WTGroup) prin). I don't think there exist a single API to get this
I've been involved in Windchill for ~ 15 years now - have seen this request posted 1000's of times. It's such a fundamental need - to get user / group info in Excel or whatever. Pretty amazing that PTC still doesn't provide any way to dump this info to a file. At Alcon we paid a consultant to come up with a custom method. Don't currently have any method. Would appreciate if others post how they have addressed this.
see the below thread. I have attached sample java class to print list of all group and its members
Would you mind adding simple instructions for using the java class?
First put groupMembers.java in %WT_HOME%\src\sh
Use the batch below to compile:
set PACKAGE_NAME=sh set CUSTOM_SRC_HOME=%WT_HOME%\src\%PACKAGE_NAME% set CUSTOM_COMPILED_HOME=%WT_HOME%\codebase\ext\%PACKAGE_NAME% set WT_CLASSPATH_COMPILE=%WT_HOME%\codebase;%WT_HOME%\srclib\tool\Annotations.jar cd /D %CUSTOM_SRC_HOME% echo. echo Compile java classes javac -d %WT_HOME%\codebase -classpath %WT_CLASSPATH_COMPILE% groupMembers.java pause
To use the class, type in a Windchill shell
windchill sh.groupMembers "Name of group"