Ensuring a Valid SPContext via Feature Activation

Posted on Leave a commentPosted in Article, SharePoint 2007

I’ve been meaning to blog about this for a while but just haven’t gotten around to it.  Have you ever needed to add a web part to a page during Feature activation?  Of course you can do this declaratively using CAML but I usually prefer to do this stuff via code.  The challenge is that occasionally you will need to activate the Feature outside the context of a web request – such as via STSADM […]

Custom List Views and WSS 4.0′s XSLT-based List View

Posted on 10 CommentsPosted in SharePoint 2010

Some of us have known about this for a while but we’ve been unable to talk about it until now – Microsoft released the following article two days ago: The CustomListView rule in Pre-Upgrade Checker can warn that customized list views that will not be upgraded.  Read this article closely because for those of you that hate the List View Web Part as much as I do you’ll be extremely pleased to hear about the […]

Web Part Page History CodePlex Project

Posted on 2 CommentsPosted in Article, SharePoint 2007

Have you ever been working with a web part page (either a standard web part page or a publishing page) and made a bunch of changes to your web part configurations and content over a period of time only to realize sometime down the road that you need to revert to a previous version?  You then go to the version history for the page and find the one you want, do the revert and then […]

Programmatically Setting Web Part Audience Targeting

Posted on 4 CommentsPosted in SharePoint 2007, STSADM Commands

I’ve been doing some work on my gl-exportlistitem2 and gl-addlistitem commands so that I can support the import of web part pages.  I thought I was about done until I discovered that I had an issue with pages and web parts that were using audience targeting.  There was actually two issues – one was that when I imported a page to another farm the GUID used to store the audience didn’t match up so it […]

Retarget Grouped Listings Web Parts

Posted on 5 CommentsPosted in SharePoint 2007, STSADM Commands

When we did our test upgrade I found that "almost" every single page that had a Grouped Listings Web Part (which is basically just a content query web part) had its source changed from showing items from the "Listings" list to instead show all items from the site. Unfortunately there were too many of them to change manually and the gl-retargetcontentquerywebpart command that I had didn’t have sufficient options to restrict the changes to do […]

SPLimitedWebPartManager.Dispose() bug

Posted on Leave a commentPosted in SharePoint 2007

I found what I believe to be a bug and figured I’d pass along my findings. If you’re working with the SPLimitedWebPartManager object and call Dispose() on it there’s a minor problem – the Dispose() method does not dispose of the SPWeb object that gets loaded up – if you’re only using one instance this isn’t much of a problem but if you’re doing a lot of looping then you’ll eventually run out of memory […]

Replace Web Part Content

Posted on 29 CommentsPosted in SharePoint 2007, STSADM Commands

If you’ve read some of my earlier posts you’ll know that I’ve been working on 3 commands to enable replacing content throughout the site in order to deal with the broken links I’ve encountered as a result of moving so many sites around for our upgrade. The first command was gl-replacefieldvalues and the second command was gl-applyupgradeareaurlmappings. This third command, gl-replacewebpartcontent, is focused on replacing content in various built-in web part types. The code for […]

Set Web Part State

Posted on 28 CommentsPosted in SharePoint 2007, STSADM Commands

As part of my upgrade I needed to be able to delete some web parts (closed or open) and close and open some web parts. In many respects this command, gl-setwebpartstate, is basically the twin to the gl-movewebpart command which I recently posted about. In fact, I created that command as a template for this command – the only difference from a code standpoint is that instead of calling MoveWebPart I’m calling either DeleteWebPart, CloseWebPart, […]

Retarget Content Query Web Part

Posted on 14 CommentsPosted in SharePoint 2007, STSADM Commands

As I was going through my upgraded and moved sites I discovered that the "Grouped Listings" web parts were not working on my webs that I’d migrated from a subsite to a site collection or moved from one site collection to another. I didn’t even notice they weren’t working at first because when viewing a published page they were simply not showing anything (no title, or message about no results being returned or anything). When […]