Browse by Tags
Sorry, but there are no more tags available to filter with.
-
-
Body: The best practice is to deploy a site branding through a web solution package. We had a third party do a branding for us, then needed to update it before they delivered the source code for the WSP to us. So I found myself needing to update a master page for multiple site collections. The master page was deployed via the WSP. If I updated it by uploading a new version of the master page to the Master Page Gallery in each site collection, I’d have to do that upload 20 times since we had 20 site collections. But if I updated the file in its Feature folder in the 12 Hive, I’d only have to do the update once, and it would take effect everywhere assuming that the master pages that were out there were not customized from the site definition. Could I use PowerShell to quickly report on the customization state of all instances of my master page? Of course! function global:Get-SPWebApplication{ Get-SPFarm |% {$_.Services} | where {'$_.TYPEName -eq "Windows SharePoint Services Web Application"'} |% {$_.WebApplications} |% {Write-Output $_} } function global:get-AllSiteCols($webAppName){ $WA = Get-SPWebApplication |where {$_.Name -eq $webAppName} return $WA.Sites } function global:report-masterPageStates($masterFilename...
-
-
Body: At my current client, we are setting up a MOSS 2007 web application that provides collaboration sites for their communities of practice. We have an initial site hierarchy of 155 sites across 20 site collections. How do you set that all up? Although we set up the 20 site collections manually (most got their own content databases, but that’s not the reason we did them manually. With only 20 items, in the time it would have taken to set up a script, it could also just be done, and it was good training for a new SharePoint support person. For the sites however, we wanted to have each site based on the Publishing site template, have a set of preconfigured lists, use a branding feature we had installed, and have a welcome page that used a particular layout and had a particular set of web parts. Because it was a publishing site, we couldn’t save it as a template. However, we could save lists as templates, so that’s what we did. Save a list as a template: $list.SaveAsTemplate($filename, $templatename, $list.Description, $true); #true if you want to #include content, $false if you don’t. Once we have several templates saved in the List Template Gallery, we need to download them and then upload them into the other site collections. So...
-
-
Body: I realize I’ve been woefully behind in my blogging about the SharePoint work I’ve done with PowerShell. Last year, I was working on a MOSS 2007 intranet website for a political action committee. At a high level, here are some of the things I did. Use the choices in a choice field as the basis for a loop. $fieldname is the name of a column that is a Choices column. $choicefield = $list.Fields[$fieldname] $choicefield.Choices | foreach { #do something } Hide a navigation node (in a site with the Publishing feature turned on. $pages = $web.Lists["Pages"] #the following performs fine because the Pages list is small, actually VERY short, just 4 #items. $pages.Items |where {$_.Title -eq $publishingPageTitle} |foreach { $pageitem = [Microsoft.SharePoint.Publishing.PublishingPage]::GetPublishingPage($_); $pageItem.IncludeInCurrentNavigation = $false} #Note that you may have to call $pageitem.Update() as well as checkin and/or publish #the item. Create a site template from a non-publishing site Actually, in this case, it was a publishing site where I used one POSH script to deactivate the publishing feature and save the site (SPWeb) as a template. I then had another POSH script that created a new site (SPWeb) from the template...
-
-
Body: Here’s a little POSH script I wrote today, generalized a bit. The web part in question shows a list that has a column named “Title”, and one named “Percentage”, where it grouped them by a column called MarketType. It started out sorting ascending by title, and afterwards sorts descending by percentage. function global:Sort-WPBiggestPercentOnTop($SPViewUsedByWP) { $oldqu = $SPViewUsedByWP.Query if $oldqu -ne "<GroupBy Collapse=""FALSE"" GroupLimit=""100""><FieldRef Name=""Market_x0020_Type"" Ascending=""FALSE"" /></GroupBy><OrderBy><FieldRef Name=""Title"" /></OrderBy>" { write-error "View not as expected"} $newqu = $oldqu.Replace("<FieldRef Name=""Title"" />","<FieldRef Name=""Percentage"" Ascending=""FALSE"" />" $SPViewUsedByWP.Query = $newqu $SPViewUsedByWP.Update() write-host "Need to reset the state of the web part toolbar, it gets changed when the view gets edited." } Category: PowerShell and SharePoint Published: 11/6/2009 3:52 PM Del.icio.us | Digg It | Technorati ...
-
-
Body: If you haven't started listening to the SharePoint Pod Show, you should! It's at www.sharepointpodshow.com , and I've listened two a few episodes so far - in particular the interviews with Andrew Connell and Jeremy Thake ( Episode 13 ). Thake even mentions my PowerShell Building Blocks (PSBB's) for SharePoint at 40 minutes, 53s to 42 minutes 45 seconds. PSBB is one of my CodePlex projects - you can find it at www.codeplex.com/PSBB . He mentions one that displays the SharePoint version number. I don't think that's actually in the PSBB collection - yet. I need to add a number of scripts to it, and work with Neil Iverson to include his. I the mean time, here is how to get the SharePoint version number. function global:Get-SPFarm{ return [Microsoft.SharePoint.Administration.SPFarm]::Local } $farm = Get-SPFarm $farm.BuildVersion The result is: Major Minor Build Revision ----- ----- ----- -------- 12 0 0 6318 --- Michael Category: PowerShell and SharePoint Published: 3/2/2009 4:11 PM Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
-
-
Body: Here's a bunch of brief things that I think are too short to merit their own post. 1) CAML syntax that ought to error but doesn't. Double, Nested Query tags return all records. Strange thing. When building a CAML query, I accidentally malformed my query syntax: Instead of <Query><Where><and> etc, I had <Query><Query><Where><And> etc.. I had an extra pair of Query tags within the outer Query tags. I would expect that to be invalid (not conforming to the CAML Query Schema for example) but it's not. Instead of throwing a error, it treats the where clause like it's not there and returns all records. 2) Anonymous Access permissions can't be set of you have the list's Advanced Settings set so users can only read their own items. This makes sense, but the connection between the disabled checkboxes on the anonymous access permissions page and the Advanced Settings is not obvious. I discovered this when I needed to allow anonymous users to be able to add items to a list (such as contact requests for a user group). To do this, you have to give anonymous users the Add items and View items permissions (you can't give Add without View). 3) There is a BDC behavior when refreshing...