It's all about the answers!

Ask a question

How to find out how many team areas each user is a member of?

Erik Mats (10511125) | asked Feb 29 '16, 5:15 p.m.
How can you find out how many team areas each user is a member of?

Accepted answer

permanent link
Erik Mats (10511125) | answered Feb 29 '16, 5:17 p.m.
I think I have a way to identify the data you are requesting, using a REST API call, the same way that the ETL jobs fetch data.

1. Try this REST API call:

The output will be:
  - For each team area (by itemId and qualified name)
    -- list all users (by itemId and name)

2. Save the output XML to a file "UserData.xml"

3. The top of the XML output will be a link to the "next" page which I expect will be empty. If not, follow that link and concatenate the result to "UserData.xml". Repeat if needed.

4. Then run this on a Linux or Cygwin command line:
cat UserData.xml  | sed 's/teamMembers><itemId>/@/g' | tr '@' '\n' | cut -d '<' -f 1 | sort | uniq -c | sort

The output will be number of team areas for each user itemId. Example:
      1 _CqtAAGaLEeSzX8ALDnR3YA
      3 _NCdyQHYnEeSnLYxGo5NAEw
      5 _19zx0HCqEeSSpfO5JdNebQ
      6 _2ArfoXCqEeSSpfO5JdNebQ

5. You can search the file UserData.xml for ItemIds to match them to user, OR open any user in jts/admin and then replace the itemId at the end of the URL with one found this way, to map the itemId to a user identity.

Ralph Schoon selected this answer as the correct answer

Donald Nong commented Feb 29 '16, 6:19 p.m.

To make it a bit more "user friendly", probably we can just do a simple search in Chrome? I know some users are just scared of Linux and/or command lines.

So basically, just use the said URL in Chrome, then in the response find the user name of interest, say "John Smith", and search the term "<name>John Smith</name>" after pressing Crtl+F. Chrome will tell you how many matches found.

Erik Mats commented Mar 01 '16, 3:31 a.m.

Thank you Donald, good ideas. In fact a user could quite easily import this into Excel and create Pivot charts in three simple steps:

1. Replace all occurrences of this string with a newline: teamMembers><itemid>
2. Replace all <> brackets with comma
3. Import as CSV in Excel

But my customer's goal was to find out if there are any users who are members of an unusually high number of team areas, so they needed to summarize somehow.

Ralph Schoon commented Feb 13 '17, 9:09 a.m.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.