SharePoint 功能激活 - 值不在预期范围内

发布于 2024-08-08 13:17:54 字数 853 浏览 5 评论 0原文

我已经开始编写一个简单的功能来创建网站栏和内容类型。如果我尝试激活该功能,它会给出错误值不在预期范围内并且没有任何帮助。如果我删除 ContentType 标签,该功能就会正常激活,并且我可以看到新创建的帐户网站列。知道 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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

许仙没带伞 2024-08-15 13:17:54

事实证明,SharePoint 对 ContentType 标记的 ID 属性中的尾随 00 不满意。更改为 01 解决了问题,或者只是在 00 后面添加一个 GUID 也可以:

<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>

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>
心头的小情儿 2024-08-15 13:17:54

它可能是您的内容类型 ID 中的大写“X”吗?内置的都是小写的,所以这可能值得一看。

服务器日志是否会提示您 SharePoint 正在查找但在此处找不到的内容?

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?

沫离伤花 2024-08-15 13:17:54

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 WSS 3.0 SDK,或查看此 MSDN 文章:http://msdn.microsoft .com/en-us/library/aa543822.aspx

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

饭团 2024-08-15 13:17:54

就我而言,我有一个基于任务类型的简单内容类型,并带有一个额外的自定义字段。 vsewss 部署是一种黑客行为,它无法打包或部署解决方案。由于这是一个如此简单的部署,我只是使用 stsadm 命令编写了一个批处理文件来完成它。

安装功能的批处理文件示例可以在 andrew connell MVP 页面找到。你只是
删除并重新创建 sp 功能目录下的功能目录(12 hive\template\features\)
将功能和清单文件复制到那里
cd 到 12 hive\bin 目录
stsadm -o activatefeature -文件名 \feature.xml -force
stsadm -o activatefeature -文件名 \feature.xml -url
iisreset

这还没有失败。不能对 vsewss 或来自 where-ever-plex 的任何其他软件包实用程序说同样的话

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文