Site Tools‎ > ‎Tips and Tricks‎ > ‎

Script to Create a Directory of Site Collaborators

Currently, only the owner(s) of a Google Site can see the list of current owners, editors and viewers.  There are times that you would like people using the Site to see who has access. You can use a script to create a list of Site collaborators (below is what the output of the script looks like).

Here's how to do this in your Google Site:

1) Create a page in your Site to hold the directory you generate. Make a note of the URL of the page, as well as the main URL of the Google Site (note: the page does not have to reside in the same Site that you are getting the directory information from - though this will usually be the case).

2) Go to More => Manage site => Apps Scripts. Click on the Add new script button.

3) Cut and paste the contents of the attached file (create_site_directory.txt) into the Apps Editor.

4) Do a Save as to the script (name it anything you want - in this example I named mine "Build Directory) and then change the parameters highlighted below taking the information you saved from step 1 for the Site URL information.

5) Click Save.

6) The script needs to be launched from somewhere within the Site the first time. Insert a link to the script in one of your Sites web pages. [Note: when you insert the link - select Apps Script and then select the buildDirectory function as seen below.  Click OK.

7. The first time you run the script (by clicking on the link you created) you will see the following messages. Click OK and Authorize and Grant access respectively.

8) Now you can go back and really run the script. Click on the link. You will see a message that says the script is running. When you see the message below, the script is complete.

9)  If you navigate back to the page you created for the Directory, you will see the finished product.

10) Note: You can set up a script "Trigger" to automatically run the script and update your Directory.  To do this, go back to the App script editor and open the script. Here, you can add a new trigger and set it up to run when you wish.

Unknown user,
Mar 29, 2012, 4:25 PM