Joel's SharePoint Architect Blog

SharePoint 2010, MOSS & WSS Tips and Consultancy Tales

Subscribe Subscribe  View Joel Jeffery's profile on LinkedIn
joelblogs.co.uk | joelj.co.uk | joeljeffery.co.uk | jfdiphoenix.co.uk

SPSite and the Recycle Bin in SharePoint 2010 SP1

Service Pack 1 for SharePoint 2010 brought us a much-needed feature – the recycle bin for SPWeb and SPSite objects.

Recycling SharePoint Sites

If you want to move an SPWeb into the recycle bin programmatically, there’s the fairly-straightforward SPWeb.Recycle() method. Once you’ve invoked this, you can restore the SPWeb from the SPSite.RecycleBin object with the Restore() method.

But, how do I recycle and restore a site collection (SPSite)?

Recycling SharePoint Site Collections

Firstly, there’s no Recycle() method on the SPSite object. Invoking Delete() removes the SPSite immediately, unless you pass in an argument to get it to perform a gradual delete. The gradual delete process is carried out by the “Gradual Delete Timer Job”, whose purpose is to delete site collections efficiently 1000 database rows at a time.

Read more on SPSite and the Recycle Bin in SharePoint 2010 SP1…

Technorati Tags: SharePoint, SharePoint 2010, SharePoint Development

The purpose of STSADM’s “copyappbincontent” command is:

stsadm –o copyappbincontent

Copies Web application–specific files, such as page resource (*.resx) files from their respective locations in the 12\CONFIG folder to the correct location in each Web application on the computer.

According to TechNet, there is no equivalent PowerShell cmd-let http://technet.microsoft.com/en-us/library/ff621081.aspxt:

No PowerShell Equivalent to stsadm -o copyappbincontent

However, there is a PowerShell cmd-let called Install-SPApplicationContent:

Install-SPApplicationContent

Copies shared application data to existing Web application folders.

Now that sounds pretty similar.

I’ve tried this out – making a custom layouts.sitemap.xml file, and invoking Install-SPApplicationContent. It copies/merges the sitemap into the correct place under inetpub\wwwroot\wss\VirtualDirectories\*\_app_bin.

Read more on STSADM copyappbincontent vs. Install-SPApplicationContent…

Technorati Tags: PowerShell, SharePoint, SharePoint 2010, SharePoint Administration, SharePoint Development

I frequently need to tear down and rebuild the SharePoint 2010 environment I use for demonstrations.

One action I need to perform pretty much weekly is removing all the installed SharePoint solutions I built to demo development topics over the previous week.

Here’s my PowerShell script. It saves me a great deal of time, I hope it save you some too!

The Script

function Uninstall-AllSPSolutions {
    param (
        [switch] $Local,
        [switch] $Confirm
    ) 

  Start-SPAssignment -Global;
  foreach($solution in (Get-SPSolution | Where-Object { $_.Deployed })) {
    write-host "Uninstalling Solution " $solution.Name;
    if($solution.DeployedWebApplications.Count -gt 0) {
      Uninstall-SPSolution $solution –AllWebApplications -Local:$Local -Confirm:$Confirm;
    } else {
      Uninstall-SPSolution $solution -Local:$Local -Confirm:$Confirm;
    }
    do {
      Start-Sleep 5;
      $solution = Get-SPSolution $solution;
    } while($solution.JobExists -and $solution.Deployed)
  }
  Stop-SPAssignment -Global;
}

Read more on Uninstall All SharePoint 2010 Solutions via PowerShell…

SharePoint Outlook Connector

Over the last few months I’ve had the privilege of being one of the contributors to the Sobiens SharePoint Outlook Connector project on CodePlex.

The project is a VSTO package that gives Outlook a new tree view panel showing connected SharePoint sites, providing a drag and drop interface to save emails and their attachments to the document libraries of your choice.

image

The Outlook Connector lets you drag emails from Outlook into document libraries in SharePoint.

The new release gives users a context menu when you right-drag email across, giving options to Copy or Move the email as an Outlook .msg file, or to Copy the email and attachments as Word documents.

Read more on SharePoint Outlook Connector…

Technorati Tags: Outlook, SharePoint, SharePoint 2010, SharePoint Development

SharePoint 2010 Locale Stapler / Master Locale

I’ve just put up another project on CodePlex. As usual, you can download the full project and source code for SharePoint 2010 Locale Stapler.

Why?

SharePoint doesn’t let you set a master locale per web application. SharePoint 2010 Publishing Features lets you specify that all sub sites inherit the locale settings from the parent… But this is sadly lacking.

How?

My project gives you a SharePoint farm solution with a couple of feature staplers (FeatureSiteTemplateAssociations) that fire for all templates (“GLOBAL”) at either the farm or web application level. On creation of a new site collection or site, the feature staple fires and looks up the regional settings of the root web at the root site collection for the web application, and then copies those settings to the current web (SharePoint site).

Read more on SharePoint 2010 Locale Stapler / Master Locale…

Technorati Tags: SharePoint, SharePoint 2010, SharePoint Administration, SharePoint Development