Unexpected Token Error in the Site Data Web Service during Crawl


Just a small note about naming conventions to take care when declaratively creating fields and content types :

Error in the Site Data Web Service. (*** 'Type' is an unexpected token. The expected token is '='. Line 246, position 344.) Local Office SharePoint Server sites

Above is the error which one of my customers reported in crawl logs when crawling a List created from a custom list definition which is using a custom content type.I would like to share the resolution to this error hoping it might be useful for someone.

Firstly, we had deployed custom site columns and content type via Features, which in turn were being used in list definition.Some of the custom Fields used spaces and special characters in the “Name” and “StaticName” in the fields.xml (used in the ContentType Feature) and schema.xml of List Definition Feature.

For e.g :

 <Field
    ID="{9FB8728C-5F3C-4e29-965A-A7B26E0ECE35}"
    Name="Document Type #"
    DisplayName="Document Type"
    SourceID="http://schemas.microsoft.com/sharepoint/v3/fields"
    StaticName="Document Type #"
    Type="Choice"
    Required="FALSE"
    Group="Custom">

As highlighted above, in this case the issue was because of spaces in “Document Type #” in the Name column above.As you know Xml Name translates to

SPField.InternalName while StaticName translates to SPField.StaticName and DisplayName is the SPField.Title.

Because of special characters in InternalName, the crawl fails with Error in the Site Data Web Service. Infact, once I tested after removing spaces, I got another similar error, this time for the # character in the name. Which shows that not only space, but special characters also aren’t allowed for field internal names.

Crawl uses GetContent method of SiteData.asmx webservice (http://msdn.microsoft.com/en-us/library/ms772581.aspx), and I was able to reproduce the issue by programmatically calling this webservice for the particular list item which contains data in field with Internalname - “Document Type #”

Ultimately, issue was resolved once I made sure to update the “Name” of the field In all three places, that is : fields.xml (where site columns are defined), contenttypes.xml (where fieldrefs for the content type are defined) and schema.xml (of list definition feature).


Skip to main content