Monday, November 29, 2010

Splitting Sites Into New Site Collections

Part of the my current migration effort consists of taking our existing 2007 farm and upgrading it to SharePoint 2010. Given that our current SharePoint 2007 farm consists of a single site collection and content database, one of my objectives is to split out some content into it's own site collection and corresponding content database.

Here, at a high level, is how I did that.The process is farily simple and straightforward:

  1. Export the selected content to a directory on the local file system using the stsadm -o export command.
  2. Rename the existing web that was just exported using stsadm -o renameweb.
    1. I renamed mine by appending _OLD" the the web name.
    2. This will ease deleting content later.
  3. Create a managed path in Central Administration to reflect the desired managed path for the new site collection.
  4. Create the new content database in Central Administration.
  5. Temporarily set the pre existing content database to "Offline" in Central Administration.
    1. This will force the new site you are about to create to be created in the new content database.
  6. Create a new top level site at the desired url, using the newly created managed path using stsadm createsite.
    1. Since this is the top level site for your new site collection, you'll need to include the -owneremail and -ownerlogin flags in the command.
  7. Import the content of the directory on the local filesystem into the newly created web using stsadm -o import.
  8. Delete the original web and subwebs using stsadm -o deleteweb.
  9. Open Central Administration and set all content databases to 'Ready'.
  10. All new subwebs created under the new site collection will be placed in the new content database. Any new subwebs created in the original site collection will be placed in the original content database.
At this point you should be able to navigate to and successfully view the content you have split off into it's own site collection. Another check is to examine the size of the newly created content database in SQL Server. It should now reflect the size of the data that was imported into it.

One final step is to make sure that the "Manage Content and Structure" option is visible under Site Actions on your new top level site . If it is not listed, you'll need select Site Settings at the new top level site and activate the following features:

  • Site Collection Features: SharePoint Server Publishing Infrastructure
  • Site Features: SharePoint Server Publishing
Once these features are activated, "Manage Site Content and Structure" will now be listed under Site Actions on the top level site of the new site collection.

Friday, October 29, 2010

An unhandled exception occurred in the Silverlight Application

I was getting "An unhandled exception occurred in the Silverlight Application" when I tried to create a new site in my new SharePoint 2010 farm. I was unable to create even the most basic blank site.

Thanks to Simon Carpentier at SharePoint Overflow, I was able to resolve this issue.



To resolve the issue, you need to go to Central Administration/Application management/(Select the web application)/General Settings/Set Web page Security Validation to "On"

Thursday, October 21, 2010

$Resources:DataSourceContentTypeName Error

After upgrading my SharePoint 2007 farm to 2010, when attempting to create  new site using a custom site template I received the error: "The content type name '$Resources:DataSourceContentTypeName;' cannot contain: " as shown below.


After many hours spent attempting to decipher log file entries, Googling, and researching, I zeroed in on the fact that I had a Reporting Services content type that seemed to have been corrupted in the upgrade process.

In 2010, the content type displayed as:


In 2007, the content type displayed correctly:


What was happening is that when I attempted to create the new site with the custom template, it was attempting to activate the corrupt content type. The solution to this issue is to simply delete and recreate the corrupt content type; but this is easier said than done.

Here is the process I used to resolve the issue.

Before a Content Type can be deleted, you must first remove it from every place it is being used. I found the easiest way to identify content type usage is to use the excellent tool SharePoint 2010 manager. This is a truly excellent tool. I was able to identify every place the offending content type was used quickly and easily, and remove it.

Once the content type was no longer being used, I was still unable to delete the content type. I would receive an error stating that the content type was "part of a feature" and could not be deleted.

The next step was to uninstall the feature, which I determined to be the "ReportServer" feature. Here's where it gets tricky. You must do things in the correct order to resolve the issue. The steps, and the order to perform them are:

  • stsadm.exe -o deactivatefeature 
  • stsadm.exe -o uninstallfeature -force 
  • stsadm.exe -o execadmsvcjobs 
  • stsadm.exe -o installfeature
  • stsadm.exe -o activatefeature
This will properly deactivate, uninstall, reinstall and activate the feature. Once this process is complete, your content types should display correctly, and not as $Resources:........

At this point you've cleaned up the corrupt content type. However, you still cannot create a new site with your custom template because the previously created template still references the old corrupt content types. You need to now create a new site template. The new template will be clean, and there will be no trace of the corrupt content types.

You can now create a site with the template.

Friday, October 1, 2010

Configuring The Unattended Service Account in SP 2010

In the process of configuring Excel Services on my test farm, I ran into an issue with enabling data refresh on Excel spreadsheets. I could get the spreadsheet to display in SharePoint, but I couldn't refresh the data.

I traced the issue to the fact that the unattended service account wasn't working properly. Further digging led me to the fact that my Target Application in the Secure Store Service application wasn't configured correctly.

Here are the steps I took to create a properly configured Target Application, and use that to configure the Unattended Service Account in Excel Services.

The first step is to create a valid Target Application in the Secure Store Service application:

Go to Cenral Administration > Manage Service Applications > Secure Store Service.

Provision the Target Application by giving it a Target Application ID, Display name, etc as shown below. It is important to select "Group" as the target application type, not individual which is the default.


Click Next and accept the defaults on the second screen. Click Next and specify the Target Application administror(s) and desired. The next box is very important. The only way I was able to get data refresh to work was to set the SharePoint Farm Account as the members. Simply enter the name of the farm admin account in the members box and validate it.

Click OK and create the Target Application. Once it's been created, you need to set the credentials for the account, so it can be encryped into the Secure Store database.

To set the credentials, select the dropdown on target Applicaton you just created and choose "Set Credentials". Enter the name of the farm account you entered as 'members', and enter the password.


At this point you've successfully created and provisioned the Target Application. The final step is to set the unattended execution account in Excel Services.

To do this, go to Central Administration > Manage Service Applications > Excel Services > Global Settings.

Scroll to the bottom of the settings page a type in the Target Application ID of the Target Application we just created. Click OK.

Once I completed these steps, I was finally able to get my Excel spreadsheets to properly refresh in Excel Services.

Thursday, September 30, 2010

No Excel Calculation Services is available in the farm

In the course of building my new SharePoint 2010 farm, when attempting to view an Excel Spreadsheet in the browser, I received the error below:


Not exactly helpful.

I dug into the log files and found an error that stated "No Excel Calculation Services is available in the farm". The next step was to figure out where this service was located and why it was not available.

A bit of digging in Central Administration led to Central Administration > Services on Server. Once there it was obvious what the problem was. The Excel Calculation Service was stopped.



I started the service and attempted to open the original spreadsheet. This time, I got a different error message, indicating that the operation could not be completed, and asking me to wait a few minutes and try again.



While I waited, I recycled the application pool and restarted the browser. This time, my spreadsheet loaded as expected. Problem solved.

Thursday, September 16, 2010

Disabling the Upload Button on a Document library

I have a document library that houses InfoPath forms. When a new form is submitted, a series of workflows are triggered and tasks assigned, etc. I had an issue where workflows were getting started multiple times, creating multiple tasks, and generally causing chaos.

I traced the issue to the fact that users were not only using the "New Document" button to create a form, but were also saving old forms and re uploading them using the "Upload" button; resulting in duplicate files, duplicate workflows, etc.

I resolved the issue by simply removing the Upload button from each page that linked to the document library. Here are the steps to do this:

1) Use SharePoint Designer to open the page in question.

2) In Design View right-click the List View Web Part and select convert to XSLT Data View  from the context menu.

3) Switch to Split View and locate the "New" button ,and you will see the XSLT code""

4) Set the "td" visibility as "hidden" as shown below:











Additionally, to prevent an unsightly 'blank space' in the menu, I moved the location of the now hidden button to the be the last button on the right of the menu.

Now users have to use the "New" button to create a new document and cannot use the upload button. Keep in mind that you'll have to do this for each view that the users have access to, as each view has it's own page that will need editing.

Friday, September 10, 2010

SharePoint 2010 List View Differences

In the course of upgrading my farm from 2007 to 2010, one of the differences I've encountered is in the List View webpart.

In my 2007 farm, I have several List Views that are filtered by user. Basically they are designed to show only 360 Reviews by others of myself; whereas the list contains all employee reviews.

This is what it looks like in SharePoint 2007:









After upgrading to 2010, this is what it looked like:














After doing a little digging, I determined that this error was caused by the Ajax settings in the new list view. I edited the webpart and enabled the two settings below:

























At this point, the List View displayed the data properly, but the style was different:









I checked the Style settings by editing the current list view, and I verified that the webpart was set to use the "Document Details" on both the 2007 farm and the 2010 farm. Evidently, the "Document Details" style behaves differently in 2010 than it does in 2007. I also made sure the default setting of "collapsed" was selected.

A little experimentation showed that if I set the list view to use the "Default" style, the webpart displayed  as I wanted, as shown below:




Tuesday, September 7, 2010

SharePoint 2010 Page Viewer Web Part Forcing Download of .htm Files

I recently ran across an issue after upgrading from SharePoint 2007 to SharePoint 2010 where a page that contained a Page Viewer Web Part that displayed a .htm file. Every time the page was rendered, the user was prompted to download and save the file. The page would not display properly, and the site would hang.

I found the answer at Impossible as Possible. This solution saved me hours of digging.

SharePoint 2010 has an enhanced security model. One aspect of this is that the setting for browser file handling is set to strict by default. As explained by Microsoft here, this is by design to prevent malicious scripts from exploiting security.

To resolve the issue simply open Central Administration\Application Management\Manage Web Applications. Scroll down until you see "Browser File handling". Change it from Strict to Permissive as shown below.




You can now view html files in the iFrame as desired.

Identifying Problematic Features After Upgrade

In the course of upgrading my SharePoint 2007 farm, one of the more frustrating experiences was identifying problematic features or items that failed to upgrade properly.

One of the issues I recently dealt with was an error produced when I selected "Site Actions", then "Manage Content and Structure". This would immediately produce an error with a cryptic correlationID message. Searching the internet produced a consensus that I had a corrupt list on the site. Here is how I tracked it down and eliminated it.

The first step was to edit the web.config file to produce a more usable error message. In the web.config, alter it so that "customErrors mode = off", and CallStack = True". Do an IIS Reset and you should now get a more usable error message.

In my case the call stack indicated that the error was because List Template ID 432 was not installed. So, I knew this was a corrupt list, and it was a list on the main page of my site. A quick Google search turned up the fact that that List Template 432 was the KPI List template, which was deprecated in SharePoint 2010. Any list in my production farm built using this template would have to be deleted.

Now that I knew what type of list it was, I went back to my production 2007 farm to identify the lists in my farm built on this template. I used ControlPoint to run a report that identified every site in my farm that had one of these lists on it.

Using this information, I set about deleting the corrupt content on my 2010 farm. Some people have indicated that you can use SharePoint Designer 2010 to connect to the site and delete the content. I was unable to do this, as SharePoint Designer would not display content for pages that contained the corrupt list.

I finally resorted to using stsadm -o forcedeletelist -url to get rid of the lists. Once I deleted the offending content, I was able to open the Manage Content and Structure page and browse site content normally.

One last tip. Once you get Manage Content and Structure working, you can simply click through every site in your Site Collection. If a site contains any corrupt items, it will produce an error rather than expanding the treeview. This is a fast way to check sites for corrupt content.

Wednesday, September 1, 2010

SharePoint 2010 Database Upgrade - Partial Success

In my last post I detailed how my SharePoint upgrade attempts have failed because of a lack of sufficient drive space in my test environment.

I attached a 500 GB external drive to my test server, truncated the transaction log to 1Mb, moved the transaction log file to the external drive, and restarted the upgrade process. Hopefully this would be more than enough disk space.

After 10 hours, Central Administration reported that the upgrade had once again failed! However, when I checked the log files, there was no mention of drive space errors, and the hard drives had plenty of room left on them. Further review of the log files indicated that the database upgrade process had reached 100% and was complete, but that there were 76 errors. Evidently these errors were the cause of the failure.

Upon restarting SharePoint I was able to open the web app successfully.  My data was intact and I was able to browse, open documents, etc. The errors were very apparent, as certain webparts and features were causing errors or not displaying.

After the "failed" database upgrade, the log file had grown from less than 1 Mb to 130 GB. The mdf file had grown from 140 GB to 250 GB.

The content database was still in Simple Recovery Model, so I truncated the transaction log by running

DBCC Shrinkfile(@LogFileLogicalName,100).

Next, I ran DBCC ShrinkDatabase(@DataBaseName)

At this point the content database was close to it's original size of 140 GB. As with any upgrading testing, the next step is to identify and resolve the logged errors, and repeat the upgrade process until it's successful.

Wednesday, August 25, 2010

SharePoint 2010 Upgrade Failure - Executing DDL Script

I'm in the process of upgrading our SharePoint 2007 farm to 2010, using the DBAttach method. I created a Server 2008R2 VM, installed SharePoint 2010 and configured the farm with default settings.

I backed up our existing content database and restored it to the new server. Our content database is approximately 150 GB, so it's quite large. I ran Test-SPContentDatabase. This reported some missing features, but indicated that none would cause the upgrade to fail. Since this is a test environment, I decided to go ahead and upgrade the database.

I then executed Mount-SPContentDatabase to upgrade and attach the content database. The process reached 19.69% after an hour and appeared to hang. I was able to log into Central Admin and monitor the process as designed. After several hours of what appeared to be no activity, I ran Sp_Who2 in SQL Management Studio and found that I had two Spids listed as SUSPENDED. One was an INSERT and one was a SELECT. One was blocking the other. SQL was deadlocked. After 13 hours, the upgrade failed.

Reviewing the upgrade log files indicated several issues:

  1. The first issue I noticed is that the issues identified by Test-SPContentDatabase (missing features) as not being fatal errors were listed in the log file as "The missing feature may cause upgrade to fail. Please install any solution which contains the feature and restart upgrade if necessary." It would appear that there is disagreement between Test-SPContentDatabase and the actual upgrade process.
  2. Secondly, and more importantly, it appears that while executing step 84 of 128, a fatal exception occurred. The following entry was recorded:
Action 4.0.98.0 of Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence failed.


[STSADM] [SPContentDatabaseSequence] [ERROR] [8/25/2010 3:50:59 AM]: Exception: Could not allocate space for object 'dbo.AllDocStreams' in database 'MOSS_WSS_Portal_Content' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
Autogrow on the SQL log file was set to 10% and had a max file growth limit.  When the upgrade process began populating the AllDocStreams Content Column, two things happened:

  1. The larger the transaction log got, the longer it began taking to autogrow. Once the autogrow process approached two minutes, errors began.
  2. Next, the transaction log grew so large that my partition ran out of disk space. 
I believe this is happening because none of the transactions are being committed during the upgrade process; thus allowing a rollback in case of failure. Paradoxically, this very failsafe is actually causing it to fail in my case.

I started with a 140 GB content database and it completely filled my 300 GB partition. When performing the upgrade, you need to plan on having plenty of drive space available. Once I moved the database to a terrabyte partition, the error was resolved. I found that, in order to reliably upgrade a SharePoint 2007 content databases to 2010, you'll need to plan for allowing the content database to triple in size during the upgrade. If your content database is 100 GB, you'll need at least 300 GB for the log files to grow.

Wednesday, August 4, 2010

Profile Import Hung on Enumerating

Having recently taken over control of our SharePoint Farm from the prior administrator, one of the issues I inherited was that the Profile Import in Central Administration was not functioning correctly.

When viewing the Profile Import page, the following error mesage was displayed in red across the top of the page:
An error has occurred while accessing the SQL Server database or the Office SharePoint Server Search Service. If this is the first time have seen this message, tray again later. If this problem persists, contact your administrator.
The result was that the profile import could not be scheduled, so I was having to run it manually every morning by logging into Central Admin and kicking the job off. The downside to this was that not only was it time consuming, but from time to time the import would hang on enumerating.

The workaround for that was to restart the search service. Sometimes the service would not start and I'd have to kill the process. In extreme cases I would have to reboot the server. Not good.

While researching this issue, I found the answer at The Geek in The Pink. A major hat tip to Pink Geek, as the query posted there solved my issue and restored my Profile Import. The process is as follows:
  • You'll need to query the MIPScheduledJob table in the SSP database. This is where the records for the full and incremental import jobs live. If they are missing, like mine were, you'll have to rebuild them.
    • These can get deleted by running  stsadm -o deletessptimerjob, which I suspect was done by the prior admin
  • To rebuild the jobs, you'll need to retrieve the original GUIDS used to identify the jobs. You can recover these GUIDs by querying the MIPObjects table in the SSP database.
  • One record in that table will have a very large XML field that will contain the GUIDS for the User Profile Full Import Job and one GUID for the User Profile Incremental Import Job.
  • Use the extracted GUIDs and insert two new records into the MIPScheduledJob table.
Once the job records have been recreated in the SSP database, you can login to Central Administration, go to the Profile Import page and you'll be able to configure and schedule the import jobs as designed.

Once I rebuilt the MIPScheduledJob table, the imports have run fine and I've had no further issues. You can grab the query to rebuild the table at Geek In the Pink.

Wednesday, July 21, 2010

SharePoint Designer Workflow Errors

If you've ever tried to debug a problematic SharePoint work flow, you know it's not a simple, clear cut process. Recently I had a workflow that was designed to strip and reset permissions on documents checked into a document library. The idea was that the creator of the document, and members of a SharePoint group would be granted access to the document, while all others would not be able to see it. In most instances, the workflow executed properly; but in some cases, it would throw an error leaving the document visible to all users.

I began troubleshooting the issue by removing all the steps in the workflow, then adding them back in, one at a time, executing the workflow after each step was added back in. It was then that I realized that the issue involved setting permissions with multiple, nested groups.

The work flow consisted of three steps:
  1. Strip permissions from the document for all users
  2. Grant Contribute permissions to the document creator
  3. Grant Contribute permissions to the "Document Reviewers" group

If I created and submitted a document, the workflow failed. If a different user created the document, it worked fine. It was then that I realized that, since I was a member of the "Document Reviewers" group, as well as the creator of the document, it was trying to grant access to me after I had already been granted access.

Once I removed myself from the group, it worked fine. The workflow would also execute fine when a user who was not a member of the group submitted a document.

If you experience errors with workflows that assign or strip user permissions, look into the composition of the group. That may hold the key to your errors.