使标题字段在自定义列表定义中强制实施唯一值(SharePoint 2010) [英] Make Title field enforce unique values in custom list definition (SharePoint 2010)

查看:157
本文介绍了使标题字段在自定义列表定义中强制实施唯一值(SharePoint 2010)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义列表定义,我试图将自定义的标题"字段重命名为名称",并使其强制执行唯一值.首先,我在自定义内容类型(Elements.xml)中引用了它:

I have a custom list definition, and I am trying to rename the custom 'Title' field to 'Name' and to make it enforce unique values. First, I referenced it in the custom content type (Elements.xml):

<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"  Name="Title"/>

,然后在列表模板(Schema.xml)中:

and then in the list template (Schema.xml):

<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Name" Type="Text" AllowDuplicateValues="FALSE" Required="TRUE"></Field>

该字段已重命名,但是我可以添加具有相同标题的列表项.如果我进入字段设置页面,则强制唯一值"属性将设置为false.我做错了如何启用它?

The field is renamed, but I can add list items with the same title. If I go in the field settings page, the Enforce unique values property is set to false. How can I enable it, what I am doing wrong?

推荐答案

要完成这项工作,您需要添加:

In order to make this work you need to add:

Required="TRUE" EnforceUniqueValues="TRUE" Indexed="TRUE"

然后删除

AllowDuplicateValues

在列表定义的 Elements.xml Schema.xml 中,对<Field>进行操作.

To your <Field> in both the Elements.xml and the Schema.xml of your list definition.

这篇关于使标题字段在自定义列表定义中强制实施唯一值(SharePoint 2010)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆