Thursday, May 11, 2006

Recently Updated documents in SharePoint

UPDATE ON 11/22/2008: This was written way back when I was working with WSS 2.0/SharePoint 2003. Please see Ryan's blog post for some updates with regards to WSS 3.0/MOSS 2007.

I came across this tip a while back, and had to reconfigure one of our document libraries today because I broke it. I figured I'd put the tip here in case I forgot it again, since I can't find it again.

How to make a Recently Updated view in a SharePoint Document Library

  1. In the document library, click Modify settings and columns

  2. Under Columns, click Add a new column

  3. Add a column called "Today" as a Single line of text column.

  4. Click Add a new column again and add a column called "ViewUntil" with the following settings:


    • Type: Calculated (calculation based on other columns)

    • Formula: [Today]+7

    • Data type returned: Date and Time, Format: Date Only
    • Unclick Add to default view


  5. Delete the "Today" column that you created earlier

  6. Back on the Customize document library screen, click Create a new view

  7. Call the view "Recently Updated" or whatever you want. Choose whatever columns you wish, but make sure to include the "ViewUntil" column. Sort however you like.


    • Under Filter, select Show items only when the following is true

    • Show the items when column "ViewUntil" "is greater than or equal to" "[Today]" And "Modified" "is greater than or equal to" "5/4/2006" (replace with the date from seven days ago)


  8. Click Ok and now you have a list view that shows documents updated in the past week. It will be updated whenever a user adds or modifies a document.

31 comments:

Anonymous said...

Joel,

Good comments, but not the answer I need...

I want to have a dynamic list of how long a document has been on a list. i.e. Each day when I look at the list the document should be seen as a day older. I can create the "aging" field (using the [Today] trick posted other places on the net...) but its static, once the document is created, it only is updated when the document is edited...

Any ideas?

Thanks.

Jim

Anonymous said...

Is-it possible to do the opposite ?

I need all document that have not been updated for 7 days...

Thanks

mail if it's possible : cpelchat@gmail.com

Morph said...

Hi Joel, I have been through your instructions, but I am none the wiser. It appears as a view, but if I update an document or upload a new one it doesn't apppear in the Recently Posted view, also how do I add it as a web part.

Any help would be very appreciative.

Many Thanks,

Jason. UK

Joelsef said...

Hi Jason,

Unfortunately, this work-around isn't perfect.

How are you uploading the files to the document library? I believe this only works if you upload a document via the SharePoint website. If you upload a document using Network Places (e.g. \\server\sitename\document library), I don't think the proper field gets populated.

Not sure about the web part question. What are you looking for?

Joel

Anonymous said...

Why don't you calculate the ViewUntil field as =[Modified]+7 and create a "Recently Modfied" view which filters all items for which ViewUntil is greater than or equal to [Today]. This way there should be no need to adjust the date in the filter.

Joelsef said...

That could work too!

Anonymous said...

Hi,
I try add formula ID & " / " & TEXT([Created]),"dd-mm-yyyy") for my column as text. After pressing OK-button i get error:
The formula contains a syntax error or is not supported.

So i like to have in this column text like: 12345 / 12.3.2007.

What went wrong?

Thanks.
Juha.

Joelsef said...

Hi Juha,

You made a slight error in the syntax. Use this instead:
=ID&"/"&TEXT([Created],"dd-mm-yyyy")

You had added an extra paren after [Created]. The closing paren should be after the yyyy".

Joel

Anonymous said...

Joel,

Thanks for this info. It's great for newbies like me.

What I am trying to do is create a view that filters tickets showing only the last hour or two. I've tried to modify your Date tip, but to no avail.

Any help you could give would be appreciated.

Jetton

Anonymous said...

In Sharepoint 2003 I have a issue list. I have a column named "Contact Date", which has a Date & Time Format. The default value is set to Today's date. I would like to have another column called "Due Date" which shows the current date & time plus 1. (For example: If the current date and time was 7/19/07 10am 05 in the "Contact Date" column I would like the "Due Date" to be 7/20/07 10am 05. With putting "=[today]+1" in the calculated field of the "Due Date" I am able to have it show 7/20/07, but it doesn't show the present time. How do I do that?

please email me @ mitchell.gehle@emersonclimate.com

Joelsef said...

That's quite a good question. I don't know the answer off the top of my head. Anyone else got an idea?

Cliff said...

I'm trying to create a View of at Task List that only shows Tasks that have a [Due Date] in the [Current Month]. Can your technique be used for this, and is the coding any different in SP 2007?

Joelsef said...

You might find this useful: http://www.sharepointblogs.com/mkruger/archive/2007/06/26/using-today-in-a-calculated-formula-birthday-lists.aspx

However, I did it and it's not working 100%. When the month changes over, the [Today] value doesn't change so it still thinks it's the month when you created the calculated column.

Anonymous said...

Works great. Of course had to modify to meet my requirements, but was easy. Thanks!

Paul said...

Hey Joel, great little tutorial. i know its pretty old...lol but i have a question.

when you start making the view and you go:

Show the items when column
ViewUntil
is greater than or equal to
[Today]
*and*
Modified
Is greather than equal to
*date*

is there away for the *date* to be a formula? like

modified
is greather than or equal to
[Modified]+14 or something? (14 being 14 days)

should i make another column and have it as a date and time, then make it so that [today] is greater than or equal to *date entered*(i already have a column for that)+14

or something like that?

i almost have it. just need a little bit more help.

Thanks.
Paul

Francesca said...

Oh, this looks good. Here's a variation. I want to create a view that will show all documents that have a "Meeting Date" of the current month - so if it's November, I'll see all documents for November meetings, if it's December, the December meeting doc set, etc.

I want to use the view with a web part on the site home page so that the docs for the current month's meetings display, then people can go to the library for the year's meeting docs.

I also have a column called "Meeting Month" that is a written out version of the month (January, February, March, etc.) which I use for grouping, if that gives you a handle.

Many thanks in advance,
FAW

Anonymous said...

Fransesca,

the easiest way to do it is make that "meeting month" column a *choice collumn* and then have your options as you said before. as you enter data you can select...say January.

Then you make a view and for the filter put this:

if: [Meeting Month] is equal to *insert current month here*

so for example you could say:

if [meeting month] = January.

The only problem with doing it this way, is you would have to change the month each month. that isnt too bad tho :)

Ryan said...

I am trying to put the record straight that this DOES NOT WORK in WSSv3/MOSS. It will not update, see http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/ for details and some workarounds.

Joelsef said...

Thanks, Ryan. :-)

JasonF said...

Joel,

This is a great fix for document libraries.

Any idea how to do this for the Sharepoint homepage? I would like to post a webpart that displays all recently updated (or uploaded) files, lists, discussions, etc.

Thanks,
Jason

Joelsef said...

Hi Jason,

You can modify the view for a list or library web part to do the same thing, if the list or library is part of the same "site."

I assume your issue is that you have a lot of subsites and want to aggregate the most update items on the home page.

I haven't done this myself, but it should be possible with the MOSS Content Query Web Part or the Data View web part (in SharePoint Designer). It's not as straightforward as editing a list web part, but they're actually more powerful if you know how to manipulate them.

Joel

Anonymous said...

Hi Joel

Your instructions on how to show "recently updated/added" documents have been very helpful. However, I still have a problem with the way Share Point ends up displaying this on my homepage:

When uploading/modifying a single document (e.g. .ppt) that is located in a folder, Share Point shows the folder under instead of the actual document that has been modified. How can I program Share Point to only show me the document and not the folder where the document is located?

Many thanks for your help
Elena

Joelsef said...

In the view settings (either in the list or in the web part) you can turn off the display folder hierarchy and just show all documents in a flat structure (and use filtering of metadata to navigate). Check out the "Folders" section in the list view settings page. Expand the "Folders" section and choose "Show all documents without folders".

Anonymous said...

Joel - many thanks :)

Anonymous said...

Will your technique allow a single document that has been updated multiple times to display a separate entry for each update? I'm trying to find a way to display it so that it lists recent changes, as opposed to just recently changed documents.

The documents I work with update frequently concerning policy, and I keep a list of recently updated documents on the front page so that staff can read the version comments to see what has changed.

Thus far, though, if I update a single document more than once, it simply moves that document to the top of the list and replaces the older update with the new one, and that is less helpful.

Any tips?

Joelsef said...

Yeah...this doesn't show version history which is what you want. This only sorts by last modified date. Subsequent modifications are not listed, only the latest.

Not sure how'd you'd do this out-of-the-box. Maybe require some coding to get a list of Recent Updated versions.

Anonymous said...

I figured that might be the case. I might need to talk with our IT people to see if there is a alternate method to get those results.

I appreciate the reply!

Anonymous said...

Is there any way to show "Latest Documents" that are posted through out the entire Sharepoint instead of library by library?

E.g. Top latest doucments in folder A, B, C, D, etc.

Joelsef said...

Anonymous: You could create a roll-up, using a DataView or a 3rd party web part, then filter it by date and group it by type or site.

alemieux3 said...

When I set this up, the view contains no documents at all. How can I go back and modify the column View Until? In case that's the issue

Joelsef said...

You need to edit the view or switch to another view. I assume you're on a newer version of SharePoint than 2003? :-)