Archive for November 11, 2013

Show Web Template

Carrying on from my previous post Hide Web Template, this post demonstrates how to show a web template in the New Site dialog for a specific web using a PowerShell script:

function Add-SPWebTemplate {
	[CmdletBinding()]
	param(
		[parameter(Position=1,Mandatory=$true)][Microsoft.SharePoint.SPWeb]$web
	)
	process {
		$templates = New-Object "System.Collections.ObjectModel.Collection``1[[Microsoft.SharePoint.SPWebTemplate, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c]]"
		$availableWebTemplates = $web.GetAvailableWebTemplates(1033);
 
		$availableWebTemplates | ForEach-Object {
			if ($_.ID -eq 53) {
				Write-Host ("Blank Internet web template is already enabled for web '", $_.Title, "' at ", $_.Url -join "") -NoNewline
				return
			}
 
			$templates.add($_)
		}
 
		$web.AllowAllWebTemplates()
		$allWebTemplates = $web.GetAvailableWebTemplates(1033);
 
		$allWebTemplates | Where{ $_.ID -eq 53 } | ForEach-Object {
			$templates.add($_)
		}
 
		Write-Host ("Enabling Blank Internet web template for web '", $_.Title, "' at ", $_.Url -join "") -NoNewline
		$web.SetAvailableWebTemplates($templates, 1033);
		$web.Update()
		Write-Host " - Done." -ForegroundColor Green
	}
}
 
 
Get-SPWebApplication | ForEach-Object {
	$_.Sites | Where { $_.ServerRelativeUrl -ne '/sites/example' } | ForEach-Object {
		$_.AllWebs | ForEach-Object {
			Add-SPWebTemplate $_
		}
	}
}

Read more

Debugging InfoPath Browser Form

If you’re using custom code with your browser enabled InfoPath forms and would like to be able to debug them, follow the steps outlined below to configure the form to enable this.

Open the Visual Studio Tool for Applications(VSTA) editor with the code behind for your InfoPath form. In the solution explorer pane, right click your project and select Properties.

Switch to the Build tab and click the Advanced button:

Advanced Button
Read more

Follow

Get every new post delivered to your Inbox

Join other followers: