Monday, January 28, 2013

TIP: Restore a Site Collection using PowerShell

Use this simple PowerShell script to backup a site collection:

Backup-SPSite -Identity YourSiteCollectionURL -Path YourBackupFilePath

And use this simple Powershell script to restore a site collection:

Restore-SPSite -Identity YourSiteCollectionURL - Path YourBackupFilePath

There are a number of additional parameters you can specify.  The one I use most commonly is the -Force option, which allows me to overwrite an existing site.

Notes
  • I use this script frequently to maintain a mirror for testing and development purposes.
References

TIP: Get Query String Values Using JavaScript

Use the following simple script to pull values from the query string:

function getQueryStrings() { 
  var assoc  = {};
  var decode = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); };
  var queryString = location.search.substring(1);
  var keyValues = queryString.split('&');
  for(var i in keyValues) {
    var key = keyValues[i].split('=');
    if (key.length > 1) {
      assoc[decode(key[0])] = decode(key[1]);
    }
  }
  return assoc;
}
var qs = getQueryStrings();
var myParam = qs["myParam"]; 
Notes
  • There are number of variations on this script, but this was the simplest that I could find - but I can't recall from whom I obtained this script!  I just wrote it down and forgot about it.  If you know, please enter a comment so that I can properly attribute this great script.  UPDATE: found it: proper credit goes to: How to get the query string by javascript?
  • I use this script for pulling values from query strings used to build dashboards.

TIP: Change Site Collection Search Results Page

To change the page that displays search results:

1) On the root site of your site collection, click the Site Actions dropdown



2) Look for the Site Settings option on this menu, and then click it.


3) On the Site Settings page, look for the Site Collection Administration section, and then click Search Settings.



4) In the Site Collection Search Results Page box, you'll see the relative URL to the default search results page.



5) Enter into this box, the relative URL to your custom search page.  For example, if you have created your own themed page, "Results.aspx," and you placed this file in the Site Pages folder, your URL would be:

/SitePages/Results.aspx

6) Leave the other settings at their default, and then click OK.

References

Sunday, January 20, 2013

SharePoint 2010 Shortcuts and General Aids

Introduction

The following are some shortcuts that can help you troubleshoot and administer SharePoint 2010.

Some Useful Administraton URL Shortcuts

FunctionURL (http://[your site]/...)Comments
Add web parts to any page?PageView=Shared&ToolPaneView=2append to any user page
Add Web Part Galleries to the Site_layouts/webpartgallerypickerpage.aspx 
Configure and Deploy New Web Parts_layouts/NewDwp.aspxUse this page to add or remove web parts from the site collection
Configure Site Directory _layouts/SiteDirectorySettings.aspx 
Configure site-wide navigation settings_layouts/SiteNavigationSettings.aspx 
Create New Alert_layouts/SubChoos.aspx 
Create New Dashboard Page_layouts/spnewdashboard.aspx 
Create New Site Content_layouts/Create.aspx 
Create New Site or Workspace_layouts/NewsbWeb.aspx 
Create New Web Part Page_layouts/spcf.aspx 
List Template Gallery_catalogs/lt/Forms/AllItems.aspx 
Master Page Gallery_catalogs/masterpage/Forms/AllItems.aspx 
Manage your Alerts_layouts/SubEdit.aspx 
Manage Site Collection Administrators_layouts/MngSiteAdmin.aspx 
Manage Sites and Workspaces_layouts/MngSubWebs.aspx 
Manage People_layouts/People.aspx 
Manage User Permissions_layouts/User.aspx 
Configure Site Navigation Link Bars_layouts/AreaNavigationSettings.aspx 
Recycle Bin_layouts/AdminRecycleBin.aspx 
Save Site as Template_layouts/SaveTmpl.aspx 
Site Settings_layouts/Settings.aspx 
Site Template Gallery_catalogs/wt/Forms/Common.aspx 
Site Column Gallery_layouts/Mngfield.aspx 
Site Content Types_layouts/Mngctype.aspx 
Site Content and Structure Manager_layouts/SiteManager.aspx 
Site Usage Summary_layouts/SpUsageWeb.aspx 
User Alerts_layouts/SiteSubs.aspx 
View All Site Content_layouts/Viewlsts.aspx 
Web Part Gallery_catalogs/wp/Forms/AllItems.aspx 
Web part maintenance modeappend ?contents=1 to the URL of the page 
Open the page in Edit Modejust type "javascript:MSOLayout_ToggleLayoutMode();" or "javascript:MSOTlPn_ShowToolPane(’2′);" in the Address bar 

These and other shortcuts can be found in the TEMPLATE folder on the 14 hive of your SharePoint 2010 Server:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\


References

Friday, January 4, 2013

Copying Visio Shape Loses Formatting

Problem

When you copy a Visio shape from one file to another or even from one sheet to another, the copied shape loses the original formatting.

Solution

This can occur when Visio automatically applies the current them to the new instance of the shape.  When this occurs:

1) Right-click on the pasted shape

2) Point to Format, and then

3) Select Remove Theme.

The original formatting will return.

References