Tuesday, 1 November 2011

SharePoint Search: Illegal operation attempted on a registry key marked for deletion

I came across this issue today when attempting to run a search query from a SharePoint 2010 farm. The UI displayed a rather ugly error message with corresponding correlation ID, which displayed as follows in the ULS logs:

Exception when fetching results: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Illegal operation attempted on a registry key that has been marked for deletion. (Exception from HRESULT: 0x800703FA) (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.Runtime.InteropServices.COMException: Illegal operation attempted on a registry key that has been marked for deletion. (Exception from HRESULT: 0x800703FA)  
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)   
at Microsoft.Office.Server.Search.Query.KeywordQueryInternal.Execute()   
at Microsoft.Office.Server.Search.Query.QueryInternal.Execute(QueryProperties properties)   
at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.Execute(QueryProperties properties)   
at SyncInvokeExecute(Object , Object[] , Object[] )   
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)   
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)   
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)   
at System.Se...).

It was solved by configuring the following Group Policy setting on the SharePoint server:

RegistrySetting

You can also configure this setting directly in the registry by creating a DisableForceUnload REG_DWORD value and setting it to 1, as follows:

image

I’m assuming from the message it related to the Query component, but unfortunately can’t be sure as my Web front-end, query, crawl and search service application roles were all located on the same server. It would be great if anyone has any information on this.

Friday, 23 July 2010

Saving a Globally Reusable Workflow as a template in SharePoint Designer

This week I made the mistake of publishing a Reusable Workflow as a Globally Reusable Workflow in SharePoint Designer, deleting the original Reusable Workflow, and then trying to save the remaining Globally Reusable Workflow as a template – well, I soon found out that you can’t!

A moment of panic set in where I thought I would have to rebuild my workflow again from scratch, but came across the “Copy and Modify” option on the workflow context menu:

Workflow

This allows you to add a new Reusable Workflow back to the site using a copy of the Globally Reusable Workflow published earlier. I could then save the new Reusable Workflow as a template - Phew!

Friday, 2 July 2010

Open list item modal dialog (lightbox) with a hyperlink in SharePoint 2010

The modal dialog appears by default in SharePoint 2010 when you add, edit or view a list item from the List View Web Part. It’s the lightbox style look and feel where the background turns dark and a new dialog opens up on top, allowing you to view and edit items without having to leave the current page.

You may want to use this functionality with a hyperlink – for example in a Content Editor Web Part on a landing page. You can do this by using the code below:

<script type="text/javascript">
var options = {
url: "/Lists/Announcements/NewForm.aspx",
        title: "Add New Announcement",
        allowMaximize: true,
        showClose: true,
        width: 625,
        height: 525,
        dialogReturnValueCallback: silentCallback};
function open() {SP.UI.ModalDialog.showModalDialog(options);}
function silentCallback(dialogResult, returnValue) {
}
function refreshCallback(dialogResult, returnValue) {
    SP.UI.Notify.addNotification('Operation Successful!');
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
</script>
<a href="javascript:open()">Click Here</a>
When you click on the “Click Here” link, it shows a dialog similar to the one pictured below:
Modal
A couple of things to note here – the “options” variable allows you to set the properties of the dialog, one of which is the dialogReturnValueCallback property. Setting this with the silentCallback function (used in the example above) returns to your landing page without a refresh. You can replace this with the refreshCallback function, which will refresh the page and show a pop-up message when an action is configured in the dialog. The best thing to do is play about with it and check out the difference.

Friday, 11 June 2010

Usage and Health Data Collection Proxy Stopped

I have been having a problem on SharePoint 2010, that has been there since beta but still exists on RTM. Everything worked fine when I first built the beta by running the Farm Configuration Wizard, but when I rebuilt the system and created the Service Applications manually in the Central Admin UI, the usage analysis Web Analytics reports were reporting zero results. I checked the Web Analytics services were started in Central Admin along with all the other usual checks and spotted that the Usage and Health Data Collection SA Proxy was Stopped in the Manage Service Application page:
UsageApplication SA Stopped
So I deleted the Usage and Health Service Application from the UI and recreated it using PowerShell with this script:

$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name "Usage and Health Data Collection Service Application" -DatabaseServer DBSERVER -DatabaseName "SharePoint_SA_Usage" -UsageService $serviceInstance > $null

However, the new SA proxy was still reporting Stopped and still no Web Analytics reports after 24 hours.
I decided to place a PSS call in the end and the answer lies in requiring to run a Provision method on the Usage and Health Data Collection Service Application Proxy after creating it in PowerShell. Therefore, if you already have a Usage and Health Service Application provisioned, you can change it by getting the GUID of the proxy from typing Get-SPServiceApplicationProxy and using it as in the below example:

$UP = Get-SPServiceApplicationProxy | where {$_.ID -eq "7636f85a-88eb-4ffc-8a31-8dbdd0812e14"}
$UP.Provision()

Create a new term in Managed Metadata with PowerShell

Use this script if you want to create a new term in the SharePoint 2010 Managed Metadata Service with PowerShell:

#Connect to Central Admin
$taxonomySite = get-SPSite http://centraladminsite:port

#Connect to Term Store in the Managed Metadata Service Application
$taxonomySession = Get-SPTaxonomySession -site $taxonomySite
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
write-host "Connection made with term store -"$termStore.Name

#Connect to the Group and Term Set
$termStoreGroup = $termStore.Groups["Group Name"]
$termSet = $termStoreGroup.TermSets["Term Set Name"]

#Create term, term description, and a synonym
$term = $termSet.CreateTerm("Test Term", 1033)
$term.SetDescription("This is a test", 1033)
$term.CreateLabel("This is a test synonym", 1033, $false)

#Update the Term Store
$termStore.CommitAll()

Wednesday, 2 June 2010

Content type publishing option missing from Site Collection Administration

Okay, you have set up your content type hub, published your content types and are now ready to use them in your lists and libraries. You go to your list, click to add from existing content types and your published content types aren’t available.

You may find this if the top level site in your site collection was created from the Blank Site template (there may also be other templates out there where this doesn’t work too). This is because the TaxonomyFeatureStapler feature does not include the Blank Site template.

You probably don’t want to go back and recreate your site collection again, so you can activate the feature manually by typing the following stsadm command:

stsadm -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http://toplevelsiteurl

Once activated, you will see the Content type publishing option appear in Site Collection Administration, as well as the Term store management option in Site Administration on the top level site. You should now be able to use your published content types as required – even in sub-sites (if not, you can repeat the stsadm command for your sub-sites, too).

Sunday, 30 May 2010

Issue indexing pages containing the Search Core Results Web Part in SharePoint 2010

I have spotted an issue with search on SharePoint 2010 when it tries to index a page containing the Search Core Results Web Part, which I am using in particular pages on a site to rollup content across an entire Web Application. When it tries to index one of these pages, the following message appears: "The SharePoint item being crawled returned an error when attempting to download the item”.

Usually, Search Center sites are created with the <noindex> attribute enabled, so you don't normally see this behaviour as the search results pages containing the Web Part are not normally indexed.​ You can choose an option in the crawl logs to prevent the page being indexed in the future, and it appears that this issue does not prevent the rest of the site from being indexed as long as the Search Core Results Web Part is not used on the home page of the site - I have noticed it can stop the whole site from bring indexed if it is.