Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Sharepoint中创建一次写入字段_Sharepoint_Sharepoint 2010 - Fatal编程技术网

在Sharepoint中创建一次写入字段

在Sharepoint中创建一次写入字段,sharepoint,sharepoint-2010,Sharepoint,Sharepoint 2010,我有一个SharePoint 2010农场 我想用自定义内容类型创建自定义文档库。我在VisualStudio中创建Listdefinitions 但我想使用只有在上传或创建新文档后才能填写的字段,然后是不可编辑但只读的字段 ShowInNewForm和ShowInEditForm属性不适用于此,因为上载文档将始终使用EditForm 如何安排?您可以在文档库中注册事件接收器和自定义编辑表单。event receiver类的方法将确保在创建项目后,任何工具或页面都不能通过SP对象模型修改字段:

我有一个SharePoint 2010农场

我想用自定义内容类型创建自定义文档库。我在VisualStudio中创建Listdefinitions

但我想使用只有在上传或创建新文档后才能填写的字段,然后是不可编辑但只读的字段

ShowInNewForm和ShowInEditForm属性不适用于此,因为上载文档将始终使用EditForm


如何安排?

您可以在文档库中注册事件接收器和自定义编辑表单。event receiver类的方法将确保在创建项目后,任何工具或页面都不能通过SP对象模型修改字段:

public override void ItemUpdating(SPItemEventProperties properties)
{
    // Cancel the update according to the content of AfterProperties.
    properties.Cancel = true;
    properties.ErrorMessage = "...";
}
如果表单不是第一次打开,自定义EditForm表单将在只读HTML元素中显示只读属性。当然,您不一定需要这样做,因为在表单中所做的任何更改都会被事件接收者拒绝,但是表单的用户体验不会更好。实际上,如果您不需要针对SP OOM更改的安全性,您可以只使用表单;用户将无法仅通过SP UI修改字段


--费达

您如何为该领域增值?你用过事件接收器吗?我想用表单增加价值。