Friday, October 17, 2008

How to hide or omit certain auto-populate fields from "Announcements"

The default view being used is called the "Summary View", which unfortunately, is not directly editable through the normal "Edit the current view" option in the webpart...or more to the point, is limited to what you can edit on it. The default columns being displayed in this view cannot be removed, although you can add more columns if you want. This of course does not help you, but what we can do is modify it through SharePoint Designer.

In SPD, connect to the site and open the "default.aspx" page. On the page (in code view), do a search for each of the following and delete them from the page:

<HTML>by </HTML><Field Name="Author"/> (this references the user who created the item)
<Field Name="Modified"/> (this references the datetime is was last modified)
Once these is removed, you'll no longer see the "By" or "Modified" information. This will not have any impact of the list itself, just on the "Summary" view being used on the page that holds the webpart. Alternatively, you can also just create a new view conatining just the columns you want to display and apply that view to the webpart.

If Apply to All the Sites (Note: Applicable for newly create announcement)

1. Added a "no author" view to the announcement list schema
(C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\AnnouncementsList\Announce\schema.xml).

2. Done by copying the summary view ... node,

3. Then making a change to the node similar to the allitems view (BaseViewID="1"), but giving it the name "No Author" and the URL "NoAuthor.aspx".

4. IISReset the server.

5. Create a new announcement list and bam! No Author view is available in the newly added web part.

The problems with this solution are:

It does not change all existing Announcement lists to add the No Author view.
It adds a new view to the actual list rather than just giving me more options for setting the web part's view.

So... anyone got any ideas of how I can get the Summary View to be selectable on displaying the author info?

PS - this is a way you can take out the By: Author line on all Announcement list view web parts if that is what you want. Just remove the related sections from view zero, do an IISReset, and the author info will be removed from all announcement list web parts that are on summary view.


Hope this helps,
Prabhakar.T

No comments: