分类 SharePoint 讨论 - 回复时默认类别为家长类别

发布于 2024-09-01 08:00:38 字数 227 浏览 5 评论 0原文

我在 SharePoint 网站中有一个讨论板,其中有一个名为“类别”的附加列。创建新讨论时,它会提示输入类别,当然这是设计使然。

问题是,回复讨论时,又提示输入类别。

如何分离回复功能,以便不提示类别并将类别设置为其所在讨论的类别?

我尝试在 SharePoint Designer 中编辑 NewForm.aspx 的副本,但您只能编辑它正在使用的 WebPart,而不能编辑显示的字段。

I have a Discussion Board in a SharePoint site which has an additional column named Category. When a new discussion is created, it prompts for Category, and of course this is by design.

The problem is that when the discussion is replied to, it prompts for the category again.

How can I separate the reply functionality so that the Category is not prompted and the Category is set to that of the discussion under which it resides?

I attempted to edit a copy of NewForm.aspx in SharePoint Designer, but you can only edit which WebPart it is using, not which fields are displayed.

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

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

发布评论

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

评论(1

江心雾 2024-09-08 08:00:38

在 SharePoint 讨论板中,有两种不同的内容类型:讨论和消息。讨论是代表整个讨论主题的文件夹,而消息则针对该文件夹内的每个回复项目。

要使类别仅可用于讨论,请不要仅将该字段添加到列表中,而是将其专门添加到该讨论区的讨论内容类型中,并确保它不会添加到消息内容类型中(如果是,请将其删除) )。


如果您实际上希望所有回复都具有“类别”字段,并使其具有与父讨论相同的值,那么不幸的是,您必须有点技巧并使用一些事件处理程序。如果您还不熟悉它们,请阅读本文了解一个基本的例子。您需要创建一个“ItemAdding”或“ItemAdded”事件并将其附加到讨论区。此事件接收器应首先检查添加的项目是消息还是讨论 (item.ContentType.Name.Equals("Message"))。然后,检索父级;消息的父级 ID 存储在显示名称为“父文件夹 ID”的字段中。检索父级的类别值,然后设置消息类别的值以匹配该值。最后一步,要使消息内容类型上的类别字段不显示在编辑表单中,您需要将该讨论板上该内容类型上的该字段的“ShowInEditForm”属性翻转为“false”。您可以使用简单的 list.ContentTypes["Message"].Fields["Category"].ShowInEditForm = false; 在对象模型中完成此操作,其中 list 是您的讨论板实例。

In a SharePoint Discussion Board, there are two separate content types: Discussion and Message. The Discussion is the folder that represents the entire thread of discussion, while the Message is for each reply item inside that folder.

To make the Category only available for the Discussions, instead of just adding the field to the list, add it specifically to the Discussion content type for that board, and make sure it is not added to the Message content type (remove it if it is).


If you want to actually have the Category field on all replies and have it have the same value as the parent discussion, unfortunately you'll have to be a little tricky and use some event handlers. If you aren't yet familiar with them, read this article for a basic example. You'll need to create an "ItemAdding" or "ItemAdded" event and attach it to the Discussion Board. This event receiver should first check if the item being added is a message or a discussion (item.ContentType.Name.Equals("Message")). Then, retrieve the parent; the ID of the parent of the message is stored in a field with the display name "Parent Folder Id". Retrieve the value of the Category for the parent, and then set the value of the Message's Category to match that. Final step, to make the Category field on the Message Content Type not shown in the Edit Form, you need to flip the "ShowInEditForm" property of that field on that content type on that discussion board to "false". You can accomplish this in the object model with a simple list.ContentTypes["Message"].Fields["Category"].ShowInEditForm = false;, where list is your discussion board instance.

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