PowerShell Update Top Link Bar or Global Navigation

I needed to update hundreds of sub sites to inherit the same top link bar as the parent site.   Using PowerShell with SharePoint, this only took a minute.

Global Navigation

Display the same navigation items as the parent site (wanted this to be checked)

 
$SiteCollection = Get-SPSite "http://sharepoint/sitecollection/" 
foreach ($subSite in $SiteCollection.AllWebs) 
{ $updateSite = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($subSite) $updateSite.Navigation.InheritGlobal = $true $updateSite.Navigation.ShowSiblings = $false $subSite.Update() 
$subSite.Dispose() } 

$SiteCollection.Dispose() 

SharePoint Navigation Button Missing in Site Settings

In the Site Settings page, the Navigation link was missing under Look and Feel.

The link to the page is: _layouts/AreaNavigationSettings.aspx

But, you might want to activate the SharePoint Server Publishing Infrastructure feature. 

 

Site Actions –> Site Settings –> under Site Collection Administration look for Site collection features.

 

The data source control failed to execute the insert command

This one should have slapped me in the face.

Some users couldn’t fire off a workflow, while others could.
The workflow was updating an item and inserting an item in another list.

hmmmm, what could it be?

The insert action of the workflow…. Some users didnt have permissions to the other list.
Updated the permissions, had the users try again, done!

PowerShell Exception calling GetLimitedWebPartManager

Using PowerShell against SharePoint, I was trying to remove a web part from a lot of pages.

Time after time I was receiving this error:

Exception calling “GetLimitedWebPartManager” with “2” argument(s): “Unable to cast COM object of type ‘Microsoft.SharePoint.Li
brary.SPRequestInternalClass’ to interface type ‘Microsoft.SharePoint.Library.ISPRequest’. This operation failed because the Q
ueryInterface call on the COM component for the interface with IID

Turned out that I wasn’t trying to work with the correct page. I was trying to work with a web part on a page in a library, but by script was working with a site page.

PowerShell SharePoint Delete Web Part

Migrated a company from SharePoint 2007 to SharePoint 2010 and hit another small bump in the process.

The core issue was related to the AllItems.aspx page in a given library had a Content Editor web part on the page. Why?  No idea, but when users tried to access the library, the Documents and Library tab were missing from the Ribbon.

This wouldn’t be an issue if I was dealing one library.

In my case, I had a Site Collection with a dozen sites, then under each of those sites were 100+ sites.  So, I only needed to update ~1,000 sites.

Options:
A. Hire someone to edit ALL of those sites / pages.
B. Our great friend PowerShell!

What I’m doing in the script:
Starting at the Site Collection.
Loop on each site.
Looping on each List in the site.
When site = Random Documents dig in a little deeper.
Get the web parts on the AllItems.aspx page.
Loop on the web parts.
If web part title = “Content Editor Web Part”
Delete it.

 $site = Get-SPSite "http://sharepointed.com/SiteCollection"

foreach ($web in $site.AllWebs)
{
foreach($List in $web.Lists)
{
If($list.Title -eq "Random Documents")
{
$webpartmanager = $web.GetLimitedWebPartManager(($web.Url + "/Random%20Documents/Forms/AllItems.aspx"), [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)

for($i=0; $i -lt $webpartmanager.WebParts.Count; $i++)
{
if($webpartmanager.WebParts[$i].Title -eq "Content Editor Web Part")
{
$webpartmanager.DeleteWebPart($webpartmanager.Webparts[$webpartmanager.WebParts[$i].ID])
}
}
}
}
$web.Update()
$web.Dispose()
}
$site.Dispose()

Are SharePoint Workflows Case Sensitive

Yes, SharePoint workflows are case sensitive!

Recently ran into a BIG issue that caused thousands of emails to be sent, because of this question.

I needed to relink a few hundred InfoPath forms, the library had an associated workflow… So, I opened SharePoint Designer, added a new step to the workflow, and published my changes.

workflow step:
Condition: If Modified By equals domain\Ihayse
Action: Stop the workflow

Why do this?
When you relink the forms in a library, the worklow will be fired.

After receiving emails and IM’s from some happy campers, I knew my workflow was wrong.

My workflow step should have read:
Condition: If Modified By equals domain\ihayse
Action: Stop the workflow

My domain name is my first initial then my last name, all in lowercase.

Increase Storage Limit for One My Site User

Out of the box, the storage allocation for My Sites is real small. In SharePoint 2010 and SharePoint 2007 you can increase the storage limits for each My Site.

In SharePoint 2010:
Central Admin > Application Management > Configure quotas and locks
First select the My Site Web Application, then select the users My Site you want to edit.
In the Site Quota Information section, change Current quota template to Individual Quota, then change Limit site storage to a maximum of: ___ to your new value.

You can also set the Send warning e-mail when site storage reaches value to remind the user they are running low on space.

Click OK, and you are ready for more storage.

Microsoft info on this topic:
http://technet.microsoft.com/en-us/library/cc263480.aspx#BKMK_ChangeQuotaTemplates