Enhancement to the Announcements List View Web part 

Tags: SharePoint Development

Announcements in SharePoint are used all over and are a very popular way to communicate updates to your end users. However, I've never been too fond of the out of box look and feel for the announcements that come when you first create a site. So, I created this neat DataFormWebPart that presents the announcements in a more streamlined fashion.

Out of box look and feel:

 

Customized Look and Feel:

 

Feature Details:

  • The "See Associated Attachments(s)" link only shows if there is an attachment for that announcement.
  • If an announcement is expired, they will not display in this view.
  • The view only shows the title and body columns. Changing the names of those columns will break the web part.
  • The web part supports rich text.

 

Installation Instructions

  1. Right click and "save target as" to download the web part definition file.
  2. After you have downloaded it, open the web part file with notepad.
  3. Search the contents for "id='{"

    Figure 1: search results

    This is the GUID that the DataFormWebPart is using to read out the list items from the announcements list. You'll need to replace this GUID with the GUID from your announcements list or you'll break the page.

  4. To retrieve your GUID, go to "View All Site Content", click on your announcements list, and click "List Settings". You'll see the GUID in the URL:

    Figure 2: URL showing what appears to be a GUID

  5. Remove the "%7B" and "%7D" off the ends, then replace all the instances of "%2D" with dashes. Take that string and replace what is in the { } in the web part file:

    Figure 3: URL after removing/replacing characters

    Figure 4: The web part file showing the updated GUID

     

  6. Save the web part file, then edit the page you want to place it on and import in onto the page (add web parts -> advanced -> browse, import -> browse to web part file on c drive -> upload -> drag and drop onto page).

    Note: if you get an error when you drop the web part onto the page that say "List not found", you entered or did not update the GUID in the web part file correctly.
 
Posted by Phillip S. Wicklund on 2-May-08
13  Comments  |  Trackback Url  | 0  Link to this post | Bookmark this post with:        
 
Failed to render control: Value does not fall within the expected range.

Comments


Ulrich Bernskovcommented onThursday, 19-Jun-2008
Thank you for sharing your code. Is there a way to trim the number of lines returned from Body? Like the "..."


Phil Wicklundcommented onMonday, 23-Jun-2008
Hey Ulrich - I'm not sure how to do that... you'll have to tweak the XSL somehow to trim the data.. Look for the @body variable.


Martin Spaldingcommented onFriday, 29-Aug-2008
Hi! I really like your customised announcements web part. Is there anyway to pin your web part to a certain view of an announcements list? What I'm trying to do is only show the announcments for a certain day through your web part.


Martin Spaldingcommented onFriday, 29-Aug-2008
Hi! I really like your customised announcements web part. Is there anyway to pin your web part to a certain view of an announcements list? What I'm trying to do is only show the announcments for a certain day through your web part.


Martin Spaldingcommented onFriday, 29-Aug-2008
Hi! I really like your customised announcements web part. Is there anyway to pin your web part to a certain view of an announcements list? What I'm trying to do is only show the announcments for a certain day through your web part.


Mike Plekkenpolcommented onThursday, 18-Dec-2008
SharePoint's ExpGroupBy function ,which you are leveraging in this, is not supported by FireFox, Safari, or Chrome. For a compatibility fix, see http://autosponge.spaces.live.com/blog/cns!D7F85948C20F0293!469.entry


lindaZaccommented onTuesday, 27-Jan-2009
All displays except for attachment link points to: /Pages/Lists/Announcements/DispForm.aspx?ID=133 instead shld point here: .../Lists/ActionsNewsEvents/DispForm.aspx?ID=133 Why? Thanks. Linda


Phil Wicklundcommented onWednesday, 28-Jan-2009
Linda, I have hard coded "Announcements" in the xml. If you have a list called "ActionsNewsEvents",you should do a find and replace, then it should work. Hope that helps.

Phil


lindaZaccommented onThursday, 29-Jan-2009
Phil, you are awesome...that did it. Phew. Not to bite the hand that feeds..but you have anything as good on Templates? THank you. Linda


Martin Spaldingcommented onTuesday, 3-Feb-2009
Great web part! Is there a way to justify the text under the "+" branch?


Phil Wicklundcommented onTuesday, 3-Feb-2009
Well - an announcement may have details that an end users may be interested in. The "Body" text serves to communicate those associated details...

Phil


Mikecommented onThursday, 5-Feb-2009
Awesome work dude! Couldn't have been any easier! You are amazing. When I get free time I'll be adding a column to show the modified date of the announcement under its title possisbiliy.


Justincommented onWednesday, 11-Feb-2009
Phil - I think by 'justify' Martin was referring to the alignment of the text rather than asking you to give a reason behind using body text! :) Any way to have the "+'s" expanded by default? And what happened to the "Add new announcement" link? Great part btw!