Thursday, October 11, 2012

Using PowerShell to Set List View Parameters in SharePoint Web Parts

While working on some modifications to the SharePoint 2010 blog site template I ran across an interesting problem. I was trying to duplicate the functionality of a particular web part; in this case, the Posts web part which outputs a formatted display of list items on the Category.aspx page of a blog site. The default web part was listed in the contents page (reachable using the "?contents=1" query string parameter) as a basic XsltListViewWebPart, which meant that I should be able to drop the Posts web part from Lists and Libraries in the web part gallery, set the view, and get the desired results. If only it were that simple.

No matter which view I picked, all the web part showed was a standard list view with rows and columns, not the nicely formatted view with the calendar page image, title link and summary information that I was after. Since it was a stock list view web part I knew it was using a view to fetch the data and then transforming it in XSL but there didn't seem to be any way to force it into using the correct view. Assuming that the view itself might be hidden from the drop-down selector, I turned to PowerShell to see if I could find out what was going on. I began by iterating through the web parts on the page to find the one I wanted and writing out the view ID...

Read more from Eric Shupps


Ten Steps to Optimize SharePoint Performance


Secrets of SharePoint Part 5: Configuring Microsoft Office SharePoint Server 2007 for Optimal Performance
Creating End User SharePoint Solutions for Performance and Scalability 
SharePoint 2010 Performance Enhancements for Administrators
Microsoft SharePoint Server 2010 for the ASP.NET Developer
Following Best Practices and Avoiding Common Errors with Microsoft Office SharePoint Server 2007 Development
SharePoint Performance and Capacity Planning Essentials
Troubleshooting Common Performance Problems in SharePoint 2010


Channel 9 Interview with Eric Shupps
SharePoint TechTalk - Different Views on Social Computing
SharePoint Post-Deployment Planning and Management


SharePoint Pod Show - Design for Performance
SharePoint Pod Show - Test Driven Development
Run As Radio - Eric Shupps Improves SharePoint Performance


Talk TechNet
Channel 9
Planet SharePoint
MVP Profile

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.