如何更新“标题”的默认值 “文档”字段 内容类型或从其继承的类型
“标题”字段被密封。 任何更新默认值的尝试都会将该值重置回“null”,
感谢您的宝贵时间。
您执行“RemoveFieldRef 和 FieldRef 立即返回”的想法与通过“文档”或继承的内容类型的界面设置属性“必需”和“默认值”相同,尽管如果我们正在构建,您的想法会有所帮助自定义内容类型。
将“标题”设置为必需并不在所有情况下都有效。 其中一种情况是当您尝试通过“新建”添加项目时(在我的例子中,它会打开一个基于 Office 2007 的模板)。
由于“标题”作为必填字段给我带来了困难,我想尝试“默认值”路线,但即使这个路线似乎也不起作用。 有什么帮助吗?
"Title" field is sealed. Any attempts to update the default value resets the value back to "null"
Thanks for your time.
Your idea of doing "RemoveFieldRef and FieldRef it right back in" would be the same as setting the properties "Required" and "Default Value" through the interface for the "Document" or inherited content types though your idea would help if we are building custom content types.
Setting "Title" to required does not work in all situations. One such situation is when you try to add a item through "New" (which in my case opens up a template based on office 2007).
Since "Title" as required field was giving me hard time, I wanted to try the "DefaultValue" route but even this one does not seem to work. Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以将RemoveFieldRef 和FieldRef 立即返回。事实上,文档内容类型本身会执行此操作以使标题不再是必需的。 在默认的 ctypeswss.xml 中,文档内容类型没有设置密封属性。
查看 [12]\TEMPLATE\FEATURES\CTypes\ctypeswss.xml 并向下滚动到第 32 行左右,查看内容类型如何执行此操作。
.b
(免责声明:我正在发高烧,所以如果我没有任何意义,请责怪我厨房里跑来跑去的棒棒糖)
You can RemoveFieldRef and FieldRef it right back in. In fact, the document content type does this itself to make the title not required. In the default ctypeswss.xml there is no sealed attribute set on the Document content type.
Check out [12]\TEMPLATE\FEATURES\CTypes\ctypeswss.xml and scroll down to about line 32 to see how the content type does this.
.b
(Disclaimer: I am running a high fever, so if I don't make any sense, blame the lollipops running around my kitchen)
使用您向“已添加项目”和“已更新项目”事件的内容类型注册的事件接收器执行此操作。 这样,每当添加新项目时,都可以为其指定默认标题。 您可以在内容类型 CAML 中注册事件接收器,如下所示:
Do this with a Event Reciever that you register with the Content Type for Items Added and Items Updated Events. This way whenever a new Item is added it can be given your default Title. You can register Event Recievers in the Content Type CAML like such:
这是我们对“Title”的发现:
(12\TEMPLATE\FEATURES\fields)
(12\TEMPLATE\FEATURES\ctypes)
(12\TEMPLATE\FEATURES\DocumentLibrary\DocLib)
通过 OM 设置默认值会在内容类型 .Update() 上将该值重置为 NULL。 这是因为“标题”被封装在 DL 定义中。
向 MS 提出服务请求。 等待结果!!!
This is what we have found for "Title":
(12\TEMPLATE\FEATURES\fields)
(12\TEMPLATE\FEATURES\ctypes)
(12\TEMPLATE\FEATURES\DocumentLibrary\DocLib)
Setting default value through OM would reset the value to NULL on content type .Update(). This is because "Title" is sealed in the DL definition.
Opened a service request with MS. Waiting for the results!!!
嗯...如果您不执行自定义内容类型,那么我建议您通过功能接收器执行您想要的操作。 您可以将该接收器附加到默认文档内容类型并根据需要处理您的列,例如设置默认值或仅在未提供用户值的情况下设置默认值。
.b
Hm... If you are not doing custom content types then I would suggest doing what you want through a feature receiver. You can attach that receiver to the default document content type and handler your columns as you like, for example setting default values or only setting default values if no user value has been provided.
.b
这种方法适用于除隐藏的“标题”字段之外的所有字段,该字段似乎非常特别
This approach works for all fields except for hidden "Title" field which seems to really special