• SharePoint 2010: Content Database not upgraded

    Problem: Every time customer would run Upgrade-SPContentDatabase on a specific Content Database it would fail. The database was stuck in a compatibility mode since it could not be upgraded to the build version of the rest of the farm.

    Troubleshooting:

    • Looked at upgrade logs and found the error 'Field name already exists'. Lucky for us, this content database only has one site collection within it.
    • I also noticed something in the logs that referenced a Workflow Content Type
    • Used this nifty powershell script to identify the list that has a duplicate field in it. This script will loop through all sites and their tasks lists, then identify which has the problem:

      $SiteURL = http://mySitecollection

      param(
      [string]$SiteURL
      )

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | out-null
    $site = new-object Microsoft.SharePoint.SPSite($SiteURL)

    #Loop over all webs
    foreach($web in $site.AllWebs)
    {
     Write-Host "Checking Web: "$web.URL
     
     #Loop over the lists
     foreach($list in $web.Lists)
     {
      #Only continue on Task lists
      if($list.BaseTemplate -eq "Tasks")
      {
       #Loop over content types
       foreach($ct in $list.ContentTypes)
       {
        $isWFCT = $ct.Id.IsChildOf([Microsoft.SharePoint.SPBuiltInContentTypeID]::WorkflowTask)
       
        if($isWFCT -eq $true)
        {
         Write-Host "   Found Workflow Content Type: "
         Write-Host "     List:  "$list.Title
         Write-Host "     CType: "$ct.Name
        
         try
         {
          $field = $list.Fields[[Microsoft.SharePoint.SPBuiltInFieldId]::WorkflowInstanceID]
         }
         catch
         {
          Write-Host "------ERROR WITH WorkflowInstanceID------" -ForegroundColor Red
         }

         try
         {
          $field = $list.Fields[[Microsoft.SharePoint.SPBuiltInFieldId]::GUID]
         }
         catch
         {
          Write-Host "------ERROR WITH GUID------" -ForegroundColor Red
         }

        }
       }
      }
     }
     
     $web.Dispose()
    }

    • the output looks something like this:

    Checking
    Web:  http://site1

    Checking
    Web:  http://site2

       Found Workflow Content Type:

         List:  My Tasks List Items

         CType: Workflow Task

    • Now the strange thing was when I went to that list, I did not see any duplicate fields in list settings. But I did see a duplicate reference in their views, in this case, it was the 'Priority' field
    • customer then made those fields appear in the views to see if there is any data in them. In this case there was not, so they decided to delete one of them.

    Cause: This site collection was once a Project Server 2007 site that was migrated to sharePoint 2010. My guess is that this caused some corruption when the site was brought over.

    Resolution: Downloaded SharePoint Manager for 2010: http://spm.codeplex.com/downloads/get/526736. This is a great tool that will allow you to view the entire structure (including lists and their fields) of a site in a tree-like structure. You have to install this tool on one of your sharepoint servers. We were able to see the duplicate field that the customer had identified to delete and deleted it via this tool. Re-ran Upgrade-SPContentDatabase successfully.

    Fight Comparison: Holyfield vs. George Foreman. Foreman was stubborn, he wouldn't go down. But Holyfield's persistence paid off in the end, just as mine did.

  • SharePoint 2010: Missing user profile from user profile service

    Problem:  a single user profile would not appear in the user profile store (Central admin >> Application Management >> Manage Service Applications >> user profile service>>Manage User Profiles). The user did exist in Active Directory.

    Troubleshooting:

    • Ran an incremental sync
    • Ran a full sync
    • Looked at ULS logs and found this error:

       "System.Net.WebException: The remote server returned an error: (404) Not Found.
         at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
         at System.Net.WebClient.DownloadData(Uri address)
         at Microsoft.Office.Server.UserProfiles.ManagementAgent.ProfileImportExportExtension.DownloadPictures(ProfileChangeData[] profiles, Boolean delayErrors)
         at Microsoft.Office.Server.UserProfiles.ManagementAgent.ProfileImportExportExtension.Microsoft.MetadirectoryServices.IMAExtensibleFileImport.GenerateImportFile(String fileName, String connectTo, String user, String password, ConfigParameterCollection configParameters, Boolean fFullImport, TypeDescriptionCollection types, String& customData)
      Forefront Identity Manager

    Cause: Customer is on October 2012 CU, this is fixed in December 2012 CU. It happens because some users added a picture to their profile and then removed it at some point.

    Resolution: Upgrade to a higher patch or, until you can plan and test the patch properly, you can perform the workaround below:

    1. Run the following SQL Query against the profile database to identify user accounts that may be missing and not coming over via your syncs:
       
      SELECT el.RecordId,el.ChangeType,el.ChangedPropertyId, el.EventTime,el.OldValue,el.NewValueData,upf.RecordID,upf.NTName,upf.PictureUrl,upf.PreferredName 
      FROM UserProfileEventLog as el
      JOIN Userprofile_full as upf
      On el.recordid=upf.recordid
      where ChangedPropertyId =23 and eventtime > '2013-03-13' and ChangeType = 4
    2. Modify eventtime to reflect the previous day or longer as appropriate
    3. ChangeType 4 reflects that the operation on the property was a delete. ChangedPropertyId =23 is the profile picture property
    4. The list of users generated from the above query will then need to have their photo updated via central administration. You can then update the photo for the user with the default gif, person.gif.

    Fight Comparison: Had to call for help on this one, so more like a professional wrestling tag team match

  • SharePoint 2013: Workaround: Cannot add web part to Community Portal page

    Requirement: Customer wants to add a Content Editor web part to Community Portal page 

    Problem: When user clicks on the Gear icon>> 'Edit Page', then clicks 'Add a Web Part' there is no response

     Workaround: Below is an out-of-the-box workaround. 

    1. Create a 'Web Part Page' (via
           SPD 2013 (SharePoint Designer 2013) or the GUI). 
                NOTE: It doesn't matter where this page lives, it will serve as
           nothing more than a place to create the Content Editor Web part and
           configure it to export to your Community Portal page.
    2. Add the Content Editor Web
           part to this 'Web Part Page' and configure it as you wish. (I added some
           text and a few hyperlinks.)
    3. Save this page.
    4. Open this page in SharePoint
           Designer 2013 and choose 'edit file'. Locate the Content editor web part
           code. The easiest thing to do is locate the tag
           <WebPartPages:ContentEditorWebPart and click on it. Now look towards
           the bottom right of SharePoint Designer and you will see a highlighted tab
           that says <WebPartPages:ContentEditor…>. Click on that tab, it will
           select all the code you need.
       
    1. Copy the code (crtl+c)
    2. Open the Community Portal in
           SharePoint Designer 2013
    3. Click on 'Edit home site page'

                 
    4. Right-click on 'default.aspx' and choose 'New from Existing Page'

                 
    5. This will create a copy of default.aspx called 'untitled.aspx'. Go to 'File>>Save As', and name
           it something like 'default2.aspx'.
    6. In the code, locate the tag
           <WpNs1:ExistingCommunitiesWebPart runat="server"
           Title=""…Place your cursor in front of it and hit 'Return'. This
           will give you some space to paste in the Content Editor Web Part
           code

                 
    7. Paste the Content Editor code
           (ctrl+v)
    8. Click 'Save'
    9. Right-click on default2.aspx (or whatever you named this page) and choose 'Set as Home Page' (This will
           now set this new page as the default home page so that when users browse
           to your Community Portal via http://domain/sites/CommunityPortal ) it will automatically go
           to this page (in my example default2.aspx)

                 
    10. Browse to your community
           portal and you will now see the Content Editor Web part there.           

                Note: I also deleted/commented out the search web part because it will now throw an
           error up at the top right

                 
    11. Go back to the code for
           default2.aspx page (or whatever you named it) and look for the tag
           <spsswc:SearchBoxScriptWebPart, click on it. Just like before, a
           highlighted tab will appear on the bottom right corner of your screen.
           Click that tab to select the code you need to remove or comment out.
    12. Remove or comment out, then     Save. You should be good now.