gpt4 book ai didi

c# - 如何使用代码隐藏创建自定义表单以在 Sharepoint 2010 中列出 (C#)

转载 作者:太空宇宙 更新时间:2023-11-03 16:32:51 28 4
gpt4 key购买 nike

我在 Visual Studio (C#) 中为 Sharepoint2010 创建了一个列表定义和列表实例。还创建了应用程序页面,默认情况下存储在布局文件夹中。我的目标是将该页面作为我列表的新形式。据我了解,应该在列表架构的那一部分完成:

<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>

我试过了:

1) 添加<New>_layouts/PIUVS/ProjectsNew.aspx</New><forms>标签。 => 然后什么都没发生

2) 将 SetupPath 更改为“_layouts/PIUVS/ProjectsNew.aspx” => 部署时出现错误:部署步骤“激活功能”时发生错误:系统找不到指定的文件。 (HRESULT 异常:0x80070002)

附言我不使用 SP Designer 或类似的程序。

最佳答案

找到解决方案。

这不应该完全在模式文件中完成。

要将自定义表单添加到 Sharepoint2010 中的列表,您应该修改内容类型。在 <ContentType>标记添加以下内容:

<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormsUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/PIUVS/ProjectsNew.aspx</New>
</FormsUrls>
</XmlDocument>
</XmlDocuments>

同时将其复制到列表架构中的 ContentType 引用中。

关于c# - 如何使用代码隐藏创建自定义表单以在 Sharepoint 2010 中列出 (C#),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10266004/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com