Monday, April 4, 2011

Troubleshooting SharePoint Issues

Since I am still in the midst of lots of SharePoint work, one of the recent items I started on was a quick list of things to check when troubleshooting. As SharePoint is a framework and a platform it's often hard to find out where issues are coming from, so I use this as a guide to track down errors:
  • Check ULS logs with the ULS Viewer
  • Verify web.configs for the affected Site
  • Check the Event Log on the Central Administration machine or the Web Front End for errors
  • Turn on/off Custom Error Reporting for Local/Developer/Test environments only
  • Check IIS logs on the Web Front End for any errors not caught by ULS (this is a rare case)
  • Clear page cache
  • Assure the SharePoint User Permissions are correct
I also have a few locations I check to see if anyone else has my same issues
  • MSDN Forums
  • SharePoint Overflow (soon to be StackExchange Overflow)
  • The SharePoint Homepage, to check for updates
I've found SharePoint to be difficult to check sometimes because its not just a web server, often pages are encapsulated within what are called WSP files, these are basically templates that pull data from a database and build the pages. It makes tracking issues down complex as often the problem is code related, not a missing bracket or end tage on a page.

Friday, February 25, 2011

SVN Release Notes with PowerShell

The environment I work in now is hevily Window-ified. This is due to the extensive use of PowerShell for the Build/Release processes and the fact the major project is a SharePoint installation. Now that we have moved to Subversion and have packages coming out, sometimes with only small fixes, I decided I needed a way to be able to get some information on a package. To be able to include this in the Build scripts I needed something in PowerShell that would query Subversion and give me a list of comments from all commits since the last release version. This worked out well, took a bit to figure out, but it came out nice in the end.

function GetLog([string]$target, [int]$base_version, [int]$target_version, $relNotesDir="C:\Temp")
{
if(($relNotesDir -eq $null) -or ($relNotesDir -eq "")) {
"The " + $relNotesDir + " is empty. `n"
$relNotesDir="C:\Temp"
}
if (!(Test-Path -Path $target)) {
$target + " does not exist.`n"
"Try the $target path again, make sure it is typed correctly and exists.`n"
exit
}
if (!(Test-Path -Path $relNotesDir)) {
"The Release Notes directory " + $relNotesDir + " does not exist.`n"
"Enter an existing directory and try again.`n"
exit
}

"Looking for changes from " + $base_version + " to " + $target_version + " in " + $target
"Writing Release Notes out to " + $relNotesDir
$releaseNotes = Join-Path -Path $relNotesDir -ChildPath( "releaseNotes_" + $target_version + ".txt")
$Command = "svn.exe"
$Range = "" + $base_version + ":" + $target_version
$Params = "log",$target,"-r",$Range,"--xml"
$svnlog = [xml](& $Command $Params)
$svnlog.log.logentry | foreach {
if ( $_.revision -gt $base_version ){
$a = ( $_.revision + " : " + $_.author + " `n " + $_.msg )
$a >> $releaseNotes
}
}
}

Hope this helps someone out!