IBM Connections change file owner. How to get the list of all the files of a user

In Connections 6 CR5 there is the possibility of changing the owner of one or more files. To do that you need to build a list of file IDs and put it in a text file that then will be used by the wsadmin command to change ownership of those files.

The problem is to find a quick way to get the list of all the files owned by a user. Here is a quick way to do that. Thanks to Adam Gartenberg for the tip.

Step 1: Log in to Connections through a browser as an admin
Step 2: Get the user id of the user’s files for which you would like to transfer ownership.   You can do this by going to the user’s profile, the id will be in the URL of the page, for example you’ll get a url that looks like this:
http://yourserver.yourcompany.com/profiles/html/profileView.do?userid=8c266840-f6df-1032-9a76-d02a14283ea9#&tabinst=Updates
Step 3: Use this API call, substitute the UUID for the user who’s files you want to transfer for the string and type that into the address control in the browser http://yourserver.yourcompany.com/files/basic/api/userlibrary/8c266840-f6df-1032-9a76-d02a14283ea9/feed?ps=500
In the above URL snippet, that will get you a feed of the first page of 500 files.  If there are less than 500 files, it will get you all of the files, if there are more than 500 files, you will need to run it for each multiple of 500 files there are in the user’s library, where you will have to increment the page parameter for each successive page, note the default page number is 1, so if there are less than 501 files, you can omit the page number parameter.
So you may have to run this a number of times depending on the number of files in the user’s library.  And if you must, create a new file for each page.
Step 4: Save the feed file and as I mentioned add an .xml extension. The feed file comes back in a less than readable and easily parseable form (using Linux command line tools that is).

Now, since I am on Windows I do not have natively the Linux command line tools, so I installed a Ubuntu bash shell in Windows ( see here for how to do that https://itsfoss.com/install-bash-on-windows/ ). You have then to install tidy on that. I issued the following commands sudo apt update then sudo apt install tidy

Step 5: Now in the Linux shell type this command:
tidy -xml library-feed-page-1.xml | grep “<td:uuid>”  | tr -d ”  ” | tr  ‘\>’  ‘ \>’ | tr ‘\<\/’ ‘ \<\/’ | awk ‘{print $2}’ | tee just-the-ids.txt

you will get as result a text file called just-the-ids.txt that contains the list of all the files owned by the user you selected before

Call4Code at Think Milano
Community written guides on OpenNTF wiki

Leave a Reply

Your email address will not be published / Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.