In SharePoint, there is a little known capability, called “per location views”. This means that you can create views that are only accessible from certain locations. In this context, “location” refers to a folder in a document library. Even though we (in the SharePoint community) keep saying “don’t use folders, don’t use folders”, I’m going to show you how this works… you know, just in case you happen to have folders in some of your document libraries. I really want to call this post “Folder Magic”
This example is of a company who owns and manages many different buildings, like apartments, office buildings, etc. Each building is represented by a folder in a document library (“Buildings”), and each building folder contains a standard set of categories, with a set of documents pertaining to each category. The categories in each building folder are: Field notes, Contracts, Photos, Reports, Budget. So, a column called “Category” has been created in the library, with these values.
What’s the goal? The goal is for a grouped view of categories to only be available after you’ve drilled down into the folder for a single building. Here are the steps, and you’ll get a better picture once you see the screenshots:
- In the “Buildings” document library, go to the document library settings, and click Advanced Settings. Change Allow management of content types to YES.
- Once you’ve done step one, go ahead and create a new standard view in your list and take a look at something. You’ll notice that in the “Folders” section of the view, there’s now an additional option to “Show this view” and pick where to show the view. That’s the gist of this blog post.
- That third option, to show the view “in folders of content type” by default only shows the one “Folder” content type. Next, we’ll be creating a new, custom content type to pick from. Go to Site Settings and Site Content Types.
- Click Create. I’m calling this content type “Building Folder” because a new folder will be created each time there is a new building that this company manages. The parent content type is Folder Content Types, and Folder.
- Next, I’m going to add a description field, so that each time a new folder is created, there can be a description associated with the folder. On the Site Content type screen for this new content type, under Columns, click Add from new site column. Call it “Folder Description”, as a Single Line of Text, and click OK.
- Go back to the “Buildings” document library, and to the document library settings. In the Content Types section, click Add from existing site content types.
- Add the “Building Folder” content type that was created at step 4.
- Now, since we’re using this custom folder content type, we don’t need that default one. Go back into the document library’s advanced settings, and change “display new folder…” to NO. Click OK.
- In the library, when I click the New drop-down box, I can now choose the “Building Folder” to create each folder:
- You can then modify the All Documents view, to add the “Folder Description” column. I went ahead and renamed it “All Folders” and set it to display only the Type, Name, and Folder Description columns.
- Create a new view. Call it “By Category”. Pick relevant columns, such as Name, Modified, Modified By, Checked Out To. In the Group By section, group it by the Category field mentioned at the beginning of this post. HERE’S THE MAGIC: In the Folders section, do this:
Setting up the view this way means that it will only show in the Views drop-down box when you’ve already drilled down into a building folder.
- This is what your grouped by view will look like:
- Another bonus regarding integration. Now, when I’m working on documents for one of these buildings while on the road, I can connect JUST THAT FOLDER to Outlook for work offline. Back at that top level in the library, click the drop-down box on a folder name:
This is very handy to be able to synchronize just one folder, instead of the whole library!
- BUT WAIT, THERE’S MORE! There is also the ability to control what options are available in the drop-down menu within each folder. Click the drop-down on a folder, see the screenshot above, and click Change New Button Order.
- Check it out, you can simply UNCHECK the folder content type! This way, users don’t have the ability to create any more sub folders under this folder. Awesome. It’s a pet peeve of mine when you have to drill down through multiple levels of folders in libraries.
- Also, you can set it up so that users can only create folders at the top level, and not documents. Go to the library’s settings page again. In the Content Types section, click Change new button order and content type. Uncheck all except the “Building Folder”. Click OK.
Think about it, you can even take this one step further. If each of these files for each building are pretty standard, you can create a content type for each type of file, so that they’re available on the NEW drop-down box. Then in scenarios (not this one) where you’d have files of each content type in each folder, you can select for ONLY that content type to be available in that folder. Have fun!
In SharePoint 2010, there is the concept of “Per Location Views” also, but the user interface is different, and the functionality is much improved. Jennifer Mason has blogged about it here: SharePoint 2010: Per Location View Settings