We are using WSS 3.0 and I was asked to see if users can set default views on a per-user basis. Is anyone aware of any method (programatic or through the GUI itself) to give users the ability to change default views on a per-user basis? The 30 minutes of googling and poking around in the administrative menus turned out to be unfruitful. If not, is this a feature of MOSS 2007?
views:
199answers:
3
+1
A:
You probably want to look into audiences which is functionality in MOSS 2007.
Unfortunately it's not available in WSS 3.0
Here's a reasonable overview. User Profiles and Audience Targeting in SharePoint 2007
Bravax
2009-12-02 17:18:49
+1
A:
If you're working in WSS 3.0, you can programmatically swtich or modify views by using a webpart which gets the ListViewWebPart and modifies the query or view on the fly. Here is some sample code I am using to filter the contents of any given view:
private ListViewWebPart GetListViewWebPart()
{
ListViewWebPart webPart = new ListViewWebPart();
foreach (WebPart wp in WebPartManager.WebParts)
{
if (wp.GetType() == typeof(ListViewWebPart))
{
webPart = (ListViewWebPart)wp;
}
}
return webPart;
}
private void ApplyStrategySecurity(string camlFilter)
{
// Get the listview webpart
ListViewWebPart wp = GetListViewWebPart();
// Apply the query to the listview
XmlDocument doc = new XmlDocument();
doc.LoadXml(wp.ListViewXml);
if (camlFilter.Length > 0)
{
XmlNode queryNode = doc.SelectSingleNode("//Query");
XmlNode whereNode = queryNode.SelectSingleNode("Where");
if (whereNode != null)
queryNode.RemoveChild(whereNode);
XmlNode newNode = doc.CreateNode(XmlNodeType.Element, "Where", string.Empty);
newNode.InnerXml = camlFilter;
queryNode.AppendChild(newNode);
}
wp.ListViewXml = doc.OuterXml;
}
Dylan Berry
2009-12-02 18:30:24
A:
Dylan, thanks for the sample code.. It works ok for a Standard list but when I try to use it on my Gantt List it doesn't seem to do anything. Any ideas?
Vinny
2010-06-29 21:24:55