Archive for the ‘SharePoint’ Category

The search service is not able to connect to the machine that hosts the administration component

Tuesday, January 24th, 2012

Another example of “when SharePoint goes wrong.” On a dev machine, the search service mysteriously stopped working. I can’t pinpoint what caused it, but SP1 and a CU were recently applied and these seem like good candidates for breaking things. When trying to admin the search service, you would see the following error:

The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component ’{guid}′ in search application ‘Search Service Application’ is in a good state and try again.

…and trying to modify the topology of the search, resulted in a spurious error:

An unhandled exception occurred in the user interface.Exception Information: Exception has been thrown by the target of an invocation.

Something was clearly unhappy. Rather than waste too much time, the simplest solution seemed to be to delete the search application and recreate it, which I duly did, via Central Admin, verified that DBs and application pools disappeared and recreated the search application, using new names and credentials. Same error. I wasted spent some looking at permissions and the usual array of logs, events and other candidates, ran PSConfig and other upgrades, all to no avail.

I figured I could create the search application via Powershell. Why should this make a difference? No idea, but worth a shot. Then thankfully, I found that someone had already done it for me. And yes, this resolved the issues. I can’t explain why seeing as this script shouldn’t do anything that the GUI doesn’t do.

Script:

(more…)

Useful SharePoint script to restart SharePoint services and IIS

Friday, December 2nd, 2011

A SharePoint developer’s life is filled with many things, but one of the most common is the old faithful iisreset, coupled with a reset of the Timer Service and the Admin Service. When you’re working on timer jobs, it can get tedious quickly to have to  keep resetting things.

So I’m sharing a useful batch script I knocked together to do it for you. It will perform three functions – restart the SharePoint 2010 Timer Service, the SharePoint 2010 Administration Service and do an IISReset. It will prompt you if you want to do each of them, and if you don’t reply within 5 seconds automatically do it.

Simply save it as a .cmd file, and then create a shortcut to it, and put that shortcut on your start menu/quick launch. Restarts ahoy!

Enjoy.

@echo off
@echo Quick SharePoint services restart - from www.thorntontechnical.com
@echo Stopping Sharepoint services...

:P1
REM - SharePoint timer service
CHOICE /C:YN /M "Restart Timer Service?" %1 /T 5 /D Y

if ERRORLEVEL ==2 GOTO P2
if ERRORLEVEL ==1 GOTO A1
:A1
net stop "sharepoint 2010 timer"
net start "sharepoint 2010 timer"
:P2
REM - SharePoint timer service
CHOICE /C:YN /M "Restart Admin Service?" %1 /T 5 /D Y
if ERRORLEVEL ==2 GOTO P3
if ERRORLEVEL ==1 GOTO A2
:A2
net stop "sharepoint 2010 administration"
net start "sharepoint 2010 administration"
:P3
REM - reset IIS
CHOICE /C:YN /M "Reset IIS?" %1 /T 5 /D Y
if ERRORLEVEL ==2 GOTO END
if ERRORLEVEL ==1 GOTO A3
:A3
iisreset -restart -noforce
:END
echo Finished. Thanks. Have fun.

Configuring certificates and trust in SharePoint 2010 for accessing Exchange Web Services

Wednesday, November 9th, 2011

Exchange is built on web services and as I posted about a while about accessing EWS from SharePoint can be pretty neat. There is a managed API to make your life even easier. However, one issue you may come across is actually getting SharePoint and Exchange to talk nicely to each other. This will walk you through some of the steps required to get things going.

(more…)

SharePoint 2010: The filename, directory name, or volume label syntax is incorrect

Monday, November 7th, 2011

This is a peculiar little bug. When creating a List Definition, you may encounter the following error when you try to deploy:

The filename, directory name or volume label syntax is incorrect.

It took a while to track the cause, seeing as a lot of info out there info out there relates to things to do with file systems, which in this case, obviously wasn’t the cause.

The bug for me was that I had created a List Definition and called it My.List.Definition – notice the multiple periods. I wanted it to match the namespaces that we were using. It turns out that the second period trips it up. When you create a List Definition with multiple periods, the List Definition only gets the first period, e.g., My.List, whereas the Elements.xml file for the List Definition still references My.List.Definition – hence it can’t deploy properly.

To fix, edit the Elements.xml file to match the List Definition name. However, I’ve experienced knock-on issues as a result of this, for example, instances of the List Definition fail to deploy. It seems more reliable to completely delete the List Definition and recreate it with at most one period in the name.

The field with Id {} defined in feature {} was found in the current site collection or in a subsite

Tuesday, November 1st, 2011

This is a known bug in Visual Studio. It seems to occur most often when using VS to deploy (and redeploy) declarative content types to a SharePoint site. I’ve seen it happen most often when deploying List Definitions and List Instances. There are a variety of steps out there to try to make it go away:

1. Retract solution, close VS, restart VS, deploy solution.
2. Deploy project, attempt to activate via UI, deactivate, retract, restart VS, deploy solution.
3. Deploy, retract, deploy. Open Task Manager, kill VSSHostP4.

Deploying after this should be resolved.

Error activating features. Field ” could not be found, it may have been deleted by another user.

This is not a bug, more of an irritation. If you’re deploying List Instances using Visual Studio, you may see this if you create your List Definition/Content Type/Fields, but then forget to add the Fields to your List Schema. At the top of the Schema, you can supply a

ContentTypeRef

(the ID of your Content Type) and then in the Fields collection, essentially copy your Field definitions in.

Other deployment related issues

One other issue you may encounter is in the ordering of items in your Feature/Package. It might seem obvious but you must ensure things are ordered in the way that they will be needed during deployment. That is,

  • Fields
  • Base content types
  • Content types that inherit base content types
  • Anything that uses the content types and fields, e.g., Document Set Content Type. Note: if your Document Set is using a custom Welcome Page (deployed via a module/element), this must be deployed first
  • List definitions
  • List instances
  • Anything else

You can arrange the deployment order in the Feature designer screen. But be warned- if you’ve got a lot of Elements in your project (and multiple projects in a solution), then it’s a pretty gnarly process.

Other deployment pointers? Leave a comment below.