Sep 26, 2009

jQuery Test Panel for SharePoint

I don’t think I’ve to told anybody how cool jQuery is, you know already, nor how to integrate in SharePoint. Let’s start with a screenshot:

image

The idea is to have a Webpart on your SharePoint site that simply executes jQuery statements.

Just great to experiment with jQuery and SharePoint or to learn jQuery.

All you need is a standard Content Editor Webpart with the following with the following content (source).













Works great with IE Developer Toolbar together.

Examples:

$(“.ms-sitetitle”) // selects the site title

$(“a[href^=’http://’]”).attr(“target”,”_blank”) // open all absolute links in a new window

$("*").click(function(event){
  $(this).hide("slow"); return false;
});
//just fun ;-)

Sep 10, 2009

Customize the My Site Portal Link

I’m waiting for two buttons from our designer, so I’ve got 10 minutes for trivial post…

One of our customers has already created hundreds of My Sites, but unfortunately all this sites are missing the portal link to the intranet. Two simple requirements: all new sites should have the portal link automatically and all existing sites should get the portal link too.

image

  1. Customizing the portal link of the root My Site site takes care that the portal link will automatically added to new my sites. You have to enter the url to the setting page directly (e.g. http://localhost:8020/_layouts/portal.aspx), otherwise you get routed to your My Site.
  2. To migrate all existing My Sites I’ve written a simple PowerShell script – what else ;-)
# Set-SPPortalLink.ps1
# e.g. . .\Set-SPPortalLink "http://localhost:81/" "Intranet" "http://intranet"

param($webAppUrl, $portalName, $portalUrl)

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$webApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($webAppUrl)

foreach($site in $webApp.Sites)
{
$site.Url | Out-Host
#impersonate site to system user
$impSite = new-object Microsoft.SharePoint.SPSite($site.ID, $site.SystemAccount.UserToken)
$impSite.PortalName = $portalName
$impsite.PortalUrl = $portalUrl

$impSite.Dispose()
$site.Dispose()
}