For SharePoint 2007:
Using a web service and a little magic, it’s possible to create your own data view web part “dashboard” to quickly get to permissions and other screens for all of the lists and libraries on your SharePoint site. Here’s an example of what the goal is:
The first column is the title of each list and library on the site, linking directly to each list or library. The Inherited Security column does two things. First of all, it displays an icon to indicate whether that list inherits permissions from the site level or not. Secondly, each of these icons is a link directly to the permissions page for that specific list or library! The third column is a bonus. For the lists that have their own separate permissions, there is a link to directly add a new user to have permissions on that list.
Okay, okay, I’ll tell you how!
This post is really an expansion on a previous post of mine, called I Love the SiteData.asmx Web Service. First step: Go to that post and go all the way through step 14. We’ll pick up from there…
This is what you have so far. It’s a list of all the lists and libraries on the site, with the inherited security and internal name.
- Now, the title of the library needs to be a link to the library itself. Click to select the title of the first document library. Click the little chevron next to it.
- In the Format As field, select Hyperlink. Click Yes at the prompt.
- Clear the Address field, and click the Function box next to it. Chose the DefaultViewURL field. Clear the Text To Display box, and choose the Title field for that one. Click OK.
- For the icons in the inherited security column, you’ll need two pretty little icons of your choosing, to indicate Yes or No. If you have MOSS, the icons in this example are already right there on the server, and are called /_layouts/images/ewr212l.gif and /_layouts/images/ewr213l.gif. Anyway, for the next step, put your cursor inside one of the cells in the Inherited Security column, and insert BOTH of these images, right next to each other.
- Click the Data View menu at the top of the screen and choose <Conditional Formatting>. Then the conditional formatting pane will be displayed on the right side of the screen.
- Let’s create the hyperlink on each icon before we set the conditional formatting.
The fun part! The first question is, where the heck does the URL come from, to get straight to a library’s permissions page? Go to one of your libraries, and click to get to the settings page, and then click on “Permissions for this list”. Go to the browser’s address bar, and select that entire URL, copy it to your clipboard, and paste in notepad. It’s time to dissect it to see how it works. Here’s what my URL looks like:
What the heck is all that? Calm down, it’s okay, it’s just the GUID. Yeah, if you scroll up and look at that Internal Name column, this stuff actually matches up. (Here is where you can see how they match up) The part that I put in red in this URL is the GUID. It’s actually the same exact GUID twice in there. To make it manageable for what we’re going to do, I’m going to replace those GUIDs with asterisks for now.
- Copy your string above (your own, not mine) to your clipboard (the second one with the asterisks). Click to select the green icon. Click the <Insert> menu, and choose Hyperlink. In the Address box, paste from your clipboard.
- Select the first asterisk. Click the little function button to the right of the address box. Select the InternalName field and click OK. Select the other asterisk, and do the same thing. This is what it’ll look like at this point:
- Click OK. Click to select the red icon, and create the exact same hyperlink on it. Both icons are going to link to the exact same thing, but only one icon will be displayed at a time, because of conditional formatting.
- Click to select the green icon. On the conditional formatting pane, click the <Create> button, and choose <Show Content>. For the condition, choose Field Name InheritedSecurity Equals true.
- Click to select the red icon. On the conditional formatting pane, click the <Create> button, and choose <Show Content>. For the condition, choose Field Name InheritedSecurity Equals false. Now the appropriate icon is displayed according to the inherited security of each of the lists.
So, do you see the pattern here? Once you know how to go to the properties page, and grab the URL of ANY properties page, you can add a column for that property, such as Title and Description, and dissect the URL, and use the InternalName to replace the GUID in the URL. Create an entire dashboard with a column to get to any settings page for your lists! You can remove that internal name column, it was just for you to see the data, for educational purposes.
So, for the third column in my original screenshot at the top, I simply clicked the permissions page on a list, and clicked to add a new user. Then, I snagged that URL and dissected it. Then, I used conditional formatting to only show that link if InheritedSecurity = false.
You all enjoy this one, and please let me know if you like it!
Oh, and here’s how to re-use this DVWP on other sites: From the browser, export the web part just as a file on your desktop. Open the file in notepad, and simply find and replace your site’s URL with the new site you want to put this web part on.