Tuesday, 4 December 2012

Troubleshooting SharePoint Quick Tip with the Logs

Troubleshooting SharePoint Quick Tip with the Logs

I just discovered a little trick for easing the process of reading and reviewing the SharePoint logs, so I thought I’d share.
Open a SharePoint log and you get an incredibly large file with so much info, especially if your logging is set to verbose. As I develop and I receive generic errors, I need to go into these aggravatingly large logs to find my real issue. Most cases it is easy enough to open it in Notepad++, search for the error and go from there.
I figured out this trick when troubleshooting a web part. I get a typical SharePoint generic error when trying to add it to a page. I find the error in the logs, and it’s just as generic there as well. Now I want to see the entire log history for adding the solution, activating the feature, and adding the web part to a page. I hope to find an error on solution install or feature activation.
So all I want to see is a small window of the log, not the entire thing. I could track my start time by staring at the server clock when I press Deploy and Activate, but even 10 seconds off can add dozens of lines in the logs.
What to do… let’s create a fresh new log for my activity.
Right before I’m about to perform my steps I want to monitor, I restart the SharePoint 2010 Tracing service. (go to Start > Administrative Tools > Services)

By restarting the service, this will create a new log file with the current date and time stamp. Now I walk through my process, recreate the error, and restart the service again. A new log file is created, and the previous one has that small window of time in it! Now I take this and I can comfortably read it, knowing I’m not reading more than I need. Sure enough, I found an assembly reference error on solution deployment.

Creating a new Service Application Proxy Group in SharePoint 2010

Creating a new Service Application Proxy Group in SharePoint 2010

As you create and manage service applications in your farm, you may decide to create additional services for different web applications. In my case, it was rather simple. I wanted a web application that didn’t use FAST, just the basic search functionality. This was on my development workstation and I wanted to keep some of the flexibility of being able to support customers on either version of search. Anyway, I created a new service application for basic search.
I went to manage my web application and clicked Service Connections, and saw that I could only select default or custom. For this single case, custom would be fine and I could just check off all of the services I wanted. I then thought larger scale, with a farm with several web applications on it, wanting to manage unique and separate services for the bunch.
There is no interface in Central Admin to create and manage additional service application groups. So a quick search online revealed Brian Cartmel’s article “Create a new Service Application Proxy Group with New-SPServiceApplicationProxyGroup”. I suggest reading it. I took his scriptlets and made me a script which created an entirely new group and assigned all of the services I wanted. See below.
New-SPServiceApplicationProxyGroup "SERVICEGROUP"

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Access Service" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Business Data Connectivity Service" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Excel Services" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Managed Metadata" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "PerformancePoint Service" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Basic Search Service Application" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Secure Store" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "WSS_UsageApplication" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "UserProfileService" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Connection to Visio Graphics Service" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Web Analytics Service Application 1" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq "Word Automation" }
Add-SPServiceApplicationProxyGroupMember "SERVICEGROUP" -Member $serviceAppProxy
To use this:
  • Open Notepad and copy the contents.
  • Find and replace SERVICEGROUP with your desired group name, in my case it was NotFAST.
  • Go to Central Admin > Manage Service Applications and walk through and specify the service applications you want to include.
  • Save the file as CreateServiceAppGroup.ps1.
  • Open SharePoint PowerShell (Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint Management Shell)
  • Navigate to where you file lives and enter .\CreateServiceAppGroup.ps1
  • Go to Central Admin > Manage Web Applications.
  • Click your web application and click Service Connections.
  • You will now see your new group listed.

Country List for Field Defs in SharePoint

Country List for Field Defs in SharePoint

Below is a country list for use in a field definition for SharePoint. Enjoy!
    <CHOICES>
      <CHOICE>Afghanistan</CHOICE>
      <CHOICE>Algeria</CHOICE>
      <CHOICE>Andorra</CHOICE>
      <CHOICE>Angola</CHOICE>
      <CHOICE>Antigua and Barbuda</CHOICE>
      <CHOICE>Argentina</CHOICE>
      <CHOICE>Armenia</CHOICE>
      <CHOICE>Australia</CHOICE>
      <CHOICE>Austria</CHOICE>
      <CHOICE>Azerbaijan</CHOICE>
      <CHOICE>Bahamas, The</CHOICE>
      <CHOICE>Bahrain</CHOICE>
      <CHOICE>Bangladesh</CHOICE>
      <CHOICE>Barbados</CHOICE>
      <CHOICE>Belarus</CHOICE>
      <CHOICE>Belgium</CHOICE>
      <CHOICE>Belize</CHOICE>
      <CHOICE>Benin</CHOICE>
      <CHOICE>Bhutan</CHOICE>
      <CHOICE>Bolivia</CHOICE>
      <CHOICE>Bosnia and Herzegovina</CHOICE>
      <CHOICE>Botswana</CHOICE>
      <CHOICE>Brazil</CHOICE>
      <CHOICE>Brunei</CHOICE>
      <CHOICE>Bulgaria</CHOICE>
      <CHOICE>Burkina Faso</CHOICE>
      <CHOICE>Burma</CHOICE>
      <CHOICE>Burundi</CHOICE>
      <CHOICE>Cambodia</CHOICE>
      <CHOICE>Cameroon</CHOICE>
      <CHOICE>Canada </CHOICE>
      <CHOICE>Cape Verde </CHOICE>
      <CHOICE>Central African Republic</CHOICE>
      <CHOICE>Chad </CHOICE>
      <CHOICE>Chile </CHOICE>
      <CHOICE>China </CHOICE>
      <CHOICE>Colombia </CHOICE>
      <CHOICE>Comoros </CHOICE>
      <CHOICE>Congo (Brazzaville)</CHOICE>
      <CHOICE>Congo (Kinshasa) </CHOICE>
      <CHOICE>Costa Rica </CHOICE>
      <CHOICE>Cote d'Ivoire </CHOICE>
      <CHOICE>Croatia </CHOICE>
      <CHOICE>Cuba </CHOICE>
      <CHOICE>Cyprus </CHOICE>
      <CHOICE>Czech Republic</CHOICE>
      <CHOICE>Denmark </CHOICE>
      <CHOICE>Djibouti </CHOICE>
      <CHOICE>Dominica </CHOICE>
      <CHOICE>Dominican Republic</CHOICE>
      <CHOICE>East Timor</CHOICE>
      <CHOICE>Ecuador </CHOICE>
      <CHOICE>Egypt </CHOICE>
      <CHOICE>El Salvador </CHOICE>
      <CHOICE>Equatorial Guinea </CHOICE>
      <CHOICE>Eritrea </CHOICE>
      <CHOICE>Estonia </CHOICE>
      <CHOICE>Ethiopia</CHOICE>
      <CHOICE>Fiji </CHOICE>
      <CHOICE>Finland</CHOICE>
      <CHOICE>France</CHOICE>
      <CHOICE>Gabon</CHOICE>
      <CHOICE>Gambia, The</CHOICE>
      <CHOICE>Georgia</CHOICE>
      <CHOICE>Germany</CHOICE>
      <CHOICE>Ghana</CHOICE>
      <CHOICE>Greece</CHOICE>
      <CHOICE>Grenada</CHOICE>
      <CHOICE>Guatemala</CHOICE>
      <CHOICE>Guinea</CHOICE>
      <CHOICE>Guinea-Bissau</CHOICE>
      <CHOICE>Guyana</CHOICE>
      <CHOICE>Haiti</CHOICE>
      <CHOICE>Holy See</CHOICE>
      <CHOICE>Honduras</CHOICE>
      <CHOICE>Hong Kong</CHOICE>
      <CHOICE>Hungary</CHOICE>
      <CHOICE>Iceland</CHOICE>
      <CHOICE>India</CHOICE>
      <CHOICE>Indonesia</CHOICE>
      <CHOICE>Iran</CHOICE>
      <CHOICE>Iraq</CHOICE>
      <CHOICE>Ireland</CHOICE>
      <CHOICE>Israel</CHOICE>
      <CHOICE>Italy</CHOICE>
      <CHOICE>Jamaica</CHOICE>
      <CHOICE>Japan</CHOICE>
      <CHOICE>Jordan</CHOICE>
      <CHOICE>Kazakhstan</CHOICE>
      <CHOICE>Kenya </CHOICE>
      <CHOICE>Kiribati</CHOICE>
      <CHOICE>Korea, North</CHOICE>
      <CHOICE>Korea, South</CHOICE>
      <CHOICE>Kosovo</CHOICE>
      <CHOICE>Kuwait</CHOICE>
      <CHOICE>Kyrgyzstan</CHOICE>
      <CHOICE>Laos</CHOICE>
      <CHOICE>Latvia</CHOICE>
      <CHOICE>Lebanon</CHOICE>
      <CHOICE>Lesotho</CHOICE>
      <CHOICE>Liberia</CHOICE>
      <CHOICE>Libya</CHOICE>
      <CHOICE>Liechtenstein</CHOICE>
      <CHOICE>Lithuania</CHOICE>
      <CHOICE>Luxembourg</CHOICE>
      <CHOICE>Macau</CHOICE>
      <CHOICE>Macedonia</CHOICE>
      <CHOICE>Madagascar</CHOICE>
      <CHOICE>Malawi</CHOICE>
      <CHOICE>Malaysia</CHOICE>
      <CHOICE>Maldives</CHOICE>
      <CHOICE>Mali</CHOICE>
      <CHOICE>Malta</CHOICE>
      <CHOICE>Marshall Islands</CHOICE>
      <CHOICE>Mauritania</CHOICE>
      <CHOICE>Mauritius</CHOICE>
      <CHOICE>Mexico</CHOICE>
      <CHOICE>Micronesia</CHOICE>
      <CHOICE>Moldova</CHOICE>
      <CHOICE>Monaco</CHOICE>
      <CHOICE>Mongolia</CHOICE>
      <CHOICE>Montenegro</CHOICE>
      <CHOICE>Morocco</CHOICE>
      <CHOICE>Mozambique</CHOICE>
      <CHOICE>Namibia</CHOICE>
      <CHOICE>Nauru</CHOICE>
      <CHOICE>Nepal</CHOICE>
      <CHOICE>Netherlands</CHOICE>
      <CHOICE>Netherlands Antilles</CHOICE>
      <CHOICE>New Zealand</CHOICE>
      <CHOICE>Nicaragua</CHOICE>
      <CHOICE>Niger</CHOICE>
      <CHOICE>Nigeria</CHOICE>
      <CHOICE>North Korea</CHOICE>
      <CHOICE>Norway</CHOICE>
      <CHOICE>Oman</CHOICE>
      <CHOICE>Pakistan</CHOICE>
      <CHOICE>Palau</CHOICE>
      <CHOICE>Palestinian Territories</CHOICE>
      <CHOICE>Panama</CHOICE>
      <CHOICE>Papua New Guinea</CHOICE>
      <CHOICE>Paraguay</CHOICE>
      <CHOICE>Peru</CHOICE>
      <CHOICE>Philippines</CHOICE>
      <CHOICE>Poland</CHOICE>
      <CHOICE>Portugal</CHOICE>
      <CHOICE>Qatar</CHOICE>
      <CHOICE>Romania</CHOICE>
      <CHOICE>Russia</CHOICE>
      <CHOICE>Rwanda</CHOICE>
      <CHOICE>Saint Kitts and Nevis</CHOICE>
      <CHOICE>Saint Lucia</CHOICE>
      <CHOICE>Saint Vincent and the Grenadines</CHOICE>
      <CHOICE>Samoa</CHOICE>
      <CHOICE>San Marino</CHOICE>
      <CHOICE>Sao Tome and Principe</CHOICE>
      <CHOICE>Saudi Arabia</CHOICE>
      <CHOICE>Senegal</CHOICE>
      <CHOICE>Serbia</CHOICE>
      <CHOICE>Seychelles</CHOICE>
      <CHOICE>Sierra Leone</CHOICE>
      <CHOICE>Singapore</CHOICE>
      <CHOICE>Slovakia</CHOICE>
      <CHOICE>Slovenia</CHOICE>
      <CHOICE>Solomon Islands</CHOICE>
      <CHOICE>Somalia</CHOICE>
      <CHOICE>South Africa</CHOICE>
      <CHOICE>South Korea</CHOICE>
      <CHOICE>Spain</CHOICE>
      <CHOICE>Sri Lanka</CHOICE>
      <CHOICE>Sudan</CHOICE>
      <CHOICE>Suriname</CHOICE>
      <CHOICE>Swaziland</CHOICE>
      <CHOICE>Sweden</CHOICE>
      <CHOICE>Switzerland</CHOICE>
      <CHOICE>Syria</CHOICE>
      <CHOICE>Taiwan</CHOICE>
      <CHOICE>Tajikistan</CHOICE>
      <CHOICE>Tanzania</CHOICE>
      <CHOICE>Thailand</CHOICE>
      <CHOICE>Timor-Leste</CHOICE>
      <CHOICE>Togo</CHOICE>
      <CHOICE>Tonga</CHOICE>
      <CHOICE>Trinidad and Tobago</CHOICE>
      <CHOICE>Tunisia</CHOICE>
      <CHOICE>Turkey</CHOICE>
      <CHOICE>Turkmenistan</CHOICE>
      <CHOICE>Tuvalu</CHOICE>
      <CHOICE>Uganda</CHOICE>
      <CHOICE>Ukraine</CHOICE>
      <CHOICE>United Arab Emirates</CHOICE>
      <CHOICE>United Kingdom</CHOICE>
      <CHOICE>United States</CHOICE>
      <CHOICE>Uruguay</CHOICE>
      <CHOICE>Uzbekistan</CHOICE>
      <CHOICE>Vanuatu</CHOICE>
      <CHOICE>Venezuela</CHOICE>
      <CHOICE>Vietnam</CHOICE>
      <CHOICE>Yemen</CHOICE>
      <CHOICE>Zambia</CHOICE>
      <CHOICE>Zimbabwe</CHOICE>
    </CHOICES>