SharePoint Feature Activation - Value does not fall within the expected range
I have started writing a simple feature to create a site column, and a content type. If I try to activate the feature as such, it gives me the error Value does not fall within the expected range and nothing much more helpful. If I remove the ContentType tag, the feature activates just fine and I can see the newly created Account site column. Any idea what the error is with the ContentType?
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas开发者_运维百科.microsoft.com/sharepoint/">
<Field
ID="{345C9562-F0D9-4327-853B-5072E296823A}"
Name="Account"
DisplayName="Account"
Type="Text"
Group="Accounts">
</Field>
<ContentType
ID="0X010100"
Name="Account Doc"
Description="Account Doc"
Version="0"
Group="Account Types">
<FieldRefs>
<FieldRef
ID="{345C9562-F0D9-4327-853B-5072E296823A}"
Name="Account"
DisplayName="Account" />
</FieldRefs>
</ContentType>
</Elements>
It turns out SharePoint was unhappy about the trailing 00 in the ID attribute of the ContentType tag. Changing to 01 fixed the problem, or just adding a GUID on the end after the 00 worked as well:
<ContentType
ID="0x010100C8813FB7C4814B44BA7FD679120EF6F5"
Name="Account Doc"
Description="Account Doc"
Version="0"
Group="Account Types">
<FieldRefs>
<FieldRef
ID="{345C9562-F0D9-4327-853B-5072E296823A}"
Name="Account"
DisplayName="Account" />
</FieldRefs>
</ContentType>
Might it be the capital "X" in your content type ID? The built-in ones are lower-case, so that might be something to look at.
Do the server logs give you any hint about what SharePoint is looking for but cannot find here?
I had a similar error message when using a generated GUID in which I'd forgotten to remove the dashes from (ie using 0x0100042061F1-2366-45d8-A7DE-5B5078E87080 instead of 0x0100042061F1236645d8A7DE5B5078E87080)
For more information on Content Type IDs, have a look in the WSS 3.0 SDK, or at this MSDN article: http://msdn.microsoft.com/en-us/library/aa543822.aspx
In my case, I had a simple content type based on the task type with one extra custom field. vsewss deployment is such a hack that it could not package or deploy the solution. Since it is such a simple deployment, I just wrote a batch file with the stsadm commands to get it done.
Examples of batch files to install features can be found at the andrew connell MVP page. You just remove and re-create the directory for the feature under the sp feature directory(12 hive\template\features\) copy the feature and manifest files there cd to the 12 hive\bin dir stsadm -o activatefeature -filename \feature.xml -force stsadm -o activatefeature -filename \feature.xml -url iisreset
This has not failed yet. Can't say the same for vsewss or any other package utility from where-ever-plex
精彩评论