Wednesday, November 30, 2011

Sharepoint URL Quick List

How many times you want to remember the Sharepoint _layouts paths but don't remember the exact name?  Well he is a list that I found...  enjoy!


URL Description
URL
Create New Site Content
url: /_layouts/create.aspx
List Template Gallery
url: /_catalogs/lt
Manage People
url: /_layouts/people.aspx
Manage Site Collection Administrators
url: /_layouts/mngsiteadmin.aspx
Manage Sites and Workspaces
url: /_layouts/mngsubwebs.aspx
Manage User Permissions
url: /_layouts/user.aspx
Master Page Gallery
url: /_catalogs/masterpage
Modify Navigation
url:/_layouts/AreaNavigationSettings.aspx
Recycle Bin
url: /_layouts/AdminRecycleBin.aspx
Site Column Gallery
url: /_layouts/mngfield.aspx
Site Content and Structure Manager
url: /_layouts/sitemanager.aspx
Site Content Types
url: /_layouts/mngctype.aspx
Site Settings
url: /_layouts/settings.aspx
Site Template Gallery
url: /_catalogs/wt
Site Usage Summary
url: /_layouts/SpUsageWeb.aspx
User Alerts
url: /_layouts/sitesubs.aspx
View All Site Content
url: /_layouts/viewlsts.aspx
Web Part Gallery
url: /_catalogs/wp
Web Part Page Maintenance
url: ?contents=1
Workflows
url: /_layouts/wrkmng.aspx

Userful Powershell / STSAdm Commands

During my SP2010 upgrade process, on of the challenges I have is constently running PowerShell scripts and piping the results to a file so that I can parse and create new scripts against the results.  I have been doing it using the old way... like using "> test.txt".  Than I found ou that you can use the CovertTo and Export options with better and consistent results.  Below are a few examples:


TEST-SPContentDatabase -name MyContentDB -webapplication http://intranet -serverinstance MyDBServer  | ConvertTo-Html | Out-file intranet.html


TEST-SPContentDatabase -name MyContentDB -webapplication http://intranet -serverinstance MyDBServer  | ConvertTo-CSV -Delimiter "~" | Out-file intranet.csv


TEST-SPContentDatabase -name MyContentDB -webapplication http://intranet -serverinstance MyDBServer  | Export-CLIXML intranet.xml



Other PowerShell Commands useful around Upgrade

Get-Command -noun SP* - similar to stsadm -help
Test-SpContentDatabase – discussed in this post
Upgrade-SPContentDatabase – to resume failed upgrades
Upgrade-SPEnterpriseSearchServiceApplication – Upgrade Search
Upgrade-SPSingleSignOnDatabase – Upgrade SSO
Mount-SPContentDatabase – Used to attach a database or multiple parallel databases to the farm. Essentially is nearly the same as the STSADM –o addcontentdatabase.   If you‘re doing parallel content database attach for example, this PowerShell method is recommended. You‘d simply run each ofthese in different command/management windows.
Upgrade-SPProjectWebInstance – Upgrade Project Server databases. Obviously this only applies with Project Server deployments, but I know there are definitely many out there.
Upgrade-SPEnterpriseSearchServiceApplication – Upgrade the Search Service Application Instance. This commandlet it designed to upgrade the content sources and configuration of search and to upgrade it into the new service application.
Set-SPSite  -- Can use this command to setup site collection admins



STSADM Commands useful around preparing for Upgrade

stsadm -o ExportIPFSAdminObjects
stsadm -o MergeContentDB
stsadm -o EnumAllWebs
stsadm -o DatabaseRepair [-deletecorruption]
stsadm -o DeleteSite [-force] [-gradualdelete]
stsadm -o DeleteWeb [-force]
stsadm -o ForceDeleteList
stsadm -o VariationsFixupTool
stsadm –o Upgrade (Used for build to build upgrades, including service packs.)

"Type" column/icon does not work in Sharepoint 2010

In SP2007, if you add "Type" column to a view (for both document library and custom list), this icon will no longer clickable after you have migrated to SP2010.  For document library, there is a KB  from Microsoft to resolve this.  However, this KB does not work for custom list that you may have.  In order to fix the issue for custom list, you need to extent the solution from KB with addtion modifcations.  Thanks to Martin Truchon's response in this TechNet entry, the required changes as available..

To fix both doc lib and custom list issues, I have combined the above and summarize what need to be done:

1. Copy the contents below and save it in a file called fldtypes_docicon.xslt file and place it in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL.

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" ddwrt:oob="true">
    <xsl:output method="html" indent="no"/>
 
  <xsl:template ddwrt:dvt_mode="body" match ="FieldRef[@Name='DocIcon']" mode="Computed_DocIcon_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:param name="folderUrlAdditionalQueryString" select="''"/>
    <xsl:choose>
      <xsl:when test="
$thisNode/@FSObjType='1'">
        <xsl:variable name="alttext">
          <xsl:choose>
            <xsl:when test="starts-with(
$thisNode/@ContentTypeId, &quot;0x0120D5&quot;)">
              <xsl:value-of select="
$thisNode/../@itemname_documentset"/>: <xsl:value-of select="$thisNode/@FileLeafRef"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="
$thisNode/../@listformtitle_folder"/>: <xsl:value-of select="$thisNode/@FileLeafRef"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="mapico" select="
$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapico"/>
        <xsl:variable name="folderIconPath">
          <xsl:call-template name="GetFolderIconSourcePath">
            <xsl:with-param name="thisNode" select="$thisNode"/>
          </xsl:call-template>
        </xsl:variable>
        <!-- This is a folder -->
        <xsl:choose>
          <xsl:when test="$RecursiveView='1'">
            <img border="0" alt="{$alttext}" src="{$folderIconPath}" />
            <xsl:choose>
              <xsl:when test="
$thisNode/@IconOverlay != ''">
                <img src="
/_layouts/images/{$thisNode/@IconOverlay.mapoly}" class="ms-vb-icon-overlay" alt="" title="" />
              </xsl:when>
            </xsl:choose>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="FolderCTID">
              <xsl:value-of select="$PagePathFinal" />RootFolder=<xsl:value-of select="
$thisNode/@FileRef.urlencode" /><xsl:value-of select="$ShowWebPart"/>&amp;FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&amp;View=<xsl:value-of select="$View"/><xsl:value-of select="$folderUrlAdditionalQueryString"/>
            </xsl:variable>
            <a href="{$FolderCTID}" onmousedown ="VerifyFolderHref(this, event,
'{$thisNode/@File_x0020_Type.url}','{$thisNode/@File_x0020_Type.progid}','{$XmlDefinition/List/@DefaultItemOpen}', '{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}', '{$thisNode/@HTML_x0020_File_x0020_Type}', '{$thisNode/@serverurl.progid}')"
               onclick="return HandleFolder(this,event,&quot;{$PagePathFinal}RootFolder=&quot; + escapeProperly(&quot;{$thisNode/@FileRef}&quot;) + '{$ShowWebPart}&amp;FolderCTID={$thisNode/@ContentTypeId}&amp;View={$View}{$folderUrlAdditionalQueryString}','TRUE','FALSE','{$thisNode/@File_x0020_Type.url}','{$thisNode/@File_x0020_Type.progid}','{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@HTML_x0020_File_x0020_Type}','{$thisNode/@serverurl.progid}','{$thisNode/@CheckoutUser.id}','{$Userid}','{$XmlDefinition/List/@ForceCheckout}','{$thisNode/@IsCheckedoutToLocal}','{$thisNode/@PermMask}');">
              <img border="0" alt="{$alttext}" title="{$alttext}" src="{$folderIconPath}" />
              <xsl:choose>
                <xsl:when test="
$thisNode/@IconOverlay != ''">
                  <img src="
/_layouts/images/{$thisNode/@IconOverlay.mapoly}" class="ms-vb-icon-overlay" alt="" title="" />
                </xsl:when>
              </xsl:choose>
            </a>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="$IsDocLib">
            <a onfocus="OnLink(this)" href="
{$thisNode/@FileRef}" onmousedown="return VerifyHref(this,event,'{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@serverurl.progid}')"
   onclick="return DispEx(this,event,'TRUE','FALSE','{$thisNode/@File_x0020_Type.url}','{$thisNode/@File_x0020_Type.progid}','{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@HTML_x0020_File_x0020_Type}','{$thisNode/@serverurl.progid}','{$thisNode/@CheckoutUser.id}','{$Userid}','{$XmlDefinition/List/@ForceCheckout}','{$thisNode/@IsCheckedoutToLocal}','{$thisNode/@PermMask}')">
              <xsl:choose>
                <xsl:when test="not (
$thisNode/@IconOverlay) or $thisNode/@IconOverlay =''">
                    <xsl:choose>
                        <xsl:when test="not (
$thisNode/@CheckoutUser.id) or $thisNode/@CheckoutUser.id =''">
                            <img border="0" alt="
{$thisNode/@FileLeafRef}" title="{$thisNode/@FileLeafRef}" src="/_layouts/images/{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapico}"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:variable name="alttext"><xsl:value-of select="
$thisNode/@FileLeafRef"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&#10;</xsl:text><xsl:value-of select="$thisNode/../@managecheckedoutfiles_header_checkedoutby"/>: <xsl:value-of select="$thisNode/@CheckoutUser.title"/></xsl:variable>
                            <img border="0" alt="{$alttext}" title="{$alttext}" src="
/_layouts/images/{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapico}" />
                            <img src="/_layouts/images/checkoutoverlay.gif" class="ms-vb-icon-overlay" alt="{$alttext}" title="{$alttext}" />                           
                        </xsl:otherwise>
                    </xsl:choose>                 
                </xsl:when>
                <xsl:otherwise >
                    <img border="0" alt="
{$thisNode/@FileLeafRef}" title="{$thisNode/@FileLeafRef}" src="/_layouts/images/{$thisNode/@IconOverlay.mapico}" />
                  <img src="
/_layouts/images/{$thisNode/@IconOverlay.mapoly}" class="ms-vb-icon-overlay" alt="" title="" />
                </xsl:otherwise>
              </xsl:choose>
            </a>
          </xsl:when>
          <xsl:otherwise>
   <a onfocus="OnLink(this)" href="{$FORM_DISPLAY}&amp;ID={$thisNode/@ID}" ONCLICK="GoToLink(this);return false;" target="_self">
     <img border="0" src="
/_layouts/images/{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapico}">
    <xsl:attribute name="alt">
      <xsl:value-of select="
$thisNode/@Title"/>
    </xsl:attribute>
    <xsl:attribute name="title">
      <xsl:value-of select="
$thisNode/@Title"/>
    </xsl:attribute>
      </img>
   </a>  
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 
</xsl:stylesheet>



2. IISReset

3. Perform the prior steps in each WFE servers.

Monday, November 28, 2011

Preparing to upgrade Sharepoint 2007 to SP2010

Well, after about 3 months worth of testings and preparations, I am about to upgrade our midsize SP2007 to SP2010 this coming weekend.  I will be doing a database attached method on a newly created "production" SP2010 farm.  In short, this is what I have:
  • 2 x WFE (HyperV VMs)
  • 4 x App Servers - Index, Enterprise Apps, SSRS, Project, SSAS, TFS (all HyperV VMs)
  • Clustered SQL 2008 R1 Servers (Physical)
We have about 10 databases totalling ~200GB.  This is going to take 2-3 hours to complete.  I know some of you would tell to do parallel upgrade.  I have tried that but have seen quite a bit of lock message on the SQL server.  To keep it safe, I am going to do this one-by-one.  At the moment, my newly created farm already has all the required custom applications/solutions deployed.  Since I have been doing mark-up db-attached on this farm for weeks, I have already documented/resolved any issues before hand.  On the day of the migration, here is what I am planning to do:

  1. Update the DNS to redirect all incoming traffic to a temp server
  2. Update MS Exchange to hold incoming email and than change the seetings to point to the two new WFEs.
  3. Backup the DBs from SP2007 servers restore it to the new cluster SQL
  4. Attached the restored DBs and grant the SP accounts the proper permissions
  5. Perform the upgrade one by one using Mount-sPContentDatabase.  When this is all done, I should be able to hit the sites.
  6. Re-deploy all the solutions
  7. Run the "Enable Features On Existing Sites" option to push down all the enterprise features.  If I don't do this, I've noticed that some of my SP2007 workflows would break.
  8. Run TEST-SPContentDatabase to see if there are issues.  Chances are I would see some but as long as not show-stopper, I am okay with it.
  9. I take this opportunity to move/re-locate any site collections to the proper content database... just to keep thing organized.
  10. Have a few users "smoke" test it.
The above are just high level view of what I'll be going thru.  There are alot more steps.  I will post the actual result and finding once I am done upgrade.

Cheers...