How to update Parent Folders Timestamps when Child contents have been modified

Something that SharePoint professionals occasionally get asked is whether it is possible to update a parent folder when child documents within it have been altered. Whilst my first response is to encourage the use of metadata and flatter file structures, it’s fair to assume that this isn’t always achievable. Some teams and personnel are comfortable with folders and don’t see a reason to change.

This blog post shows how you would achieve this using Documents Sets and SharePoint Designer. Document Sets are a bit more flexible than folders. As such this approach doesn’t lend itself well to existing folder structures: –

  1. Create a Site Column called DocSetName. Make it a Single line of text data type
  2. Create a LastModified column. Make it a Date/Time data type
  3. In the document library, where you want to make these changes, activate the management of content types via Document Library Settings à Advanced Settings à Content Types
  4. Click “Add from existing site content types” and add the Document Sets
  5. In the content type section, click on Document Set à Add from existing site or list columns and add DocSetName and LastModified
  6. Next (still within the Document Set Content Type Settings) click on Document Set Settings and scroll down to Shared Columns. Select DocSetName
  7. Next, within SharePoint Designer, create a new workflow at the document library level
  8. Set this workflow to automatically start when an item is created or changed. Using the Update List Item (update item in current list) action set the “LastModified” column to the current document item “Modified” column value. What this means is that any new document “Modified” column will be update the LastModified field of its parent Document Set.
  9. Back in your library, create a view that sorts by LastModified (descending) and you’ll see that the Document Set with the most recently edited item will be on top

The caveat

There is one trade off to getting this working and it’s this. Any new items created within a Document Set MUST have the name of the Document Set manually entered into the DocSetName column. If this isn’t done than the workflow will error out. The reasoning behind this is explained below.

What does the workflow do?

This idea is that each Document Set shares the DocSetName column value with any document contained within it. As set up in step 3 any document that gets created or get modified will trigger the workflow. The workflow effectively goes to find the item whose “Name” column value is equal to current document item “DocSetName” column value. Subsequently it will always find the parent Document Set item and update its “LastModified” column with the current document modified date.

This means that each document set “LastModified” value is always going to be equal to the modified time of one of the child documents within it. Without the DocSetName column on the document level being manually filled, the workflow cannot make the association and will return an error.

That about covers it but let me know if you have any questions, suggestions and so on.


My thoughts on taking part in ForumJam

This year was the first year that I’ve taken part in Chris Given‘s ForumJam. I’d not heard of it before and only came across it via my (criminally underused) Twitter feed. Looking at some of the names that were going to enter it, I didn’t think I was in with a chance of getting in the upper ranks

But throwing caution to the wind I decided to enter, I thought it might be fun.

At the end of the two month period of the ForumJam I found myself in third place behind Trevor Seward (@NaupliusTrevor) and Amit Vasu (@AmitVasu) in the standings. I was lucky to claim the position I did in the end as Dimitri Ayrapetov(@dayrapetov) pushed me all the way. Despite being a member of the community for a fair while, this was pretty much the biggest event that I’d entered.

Chris has already outlined some of the advantages from an organiser’s perspective and some of these ring true from a participant’s perspective too. Namely: –

  • Networking & Education: I have my areas of familiarity and experience with the product, as does everyone else. Watching the others at the top of the leader board tackle and answer questions that I was quite honestly clueless on is quite rewarding. I’ve got some new blogs. Feeds and fellow professionals to follow and discuss things with.
  • Sets a new benchmark for personal performance: Hitting up on Chris’ theme of inspiring people to get involved, my time participating set some all high benchmarks for my own performance. When I joined the forums and started collaborating and offering help, the points system hadn’t even been implemented! Looking at my current trajectory, I’ve set my two best months ever (in terms of answers and accumulated points).

I’m rather pleased with my performance in my first ever FoumJam and more so for the people I’ve met. As for the eventual prize, I’m hoping I can blow it on Infamous Second Son

Here’s to the next ForumJam!