如何限制用户将特定类型的文件附加到列表中的项目

发布于 2024-08-21 01:29:42 字数 119 浏览 4 评论 0原文

如何限制用户将特定类型的文件附加到列表中的项目?现在我可以将任何类型的文件附加到项目上。但我想限制用户只上传图像。如果用户将上传任何其他内容,那么我想显示错误 信息 。另外,我如何限制用户只能将最多一个文件上传到特定项目?

How to restrict user to attach particular type of files to items in a list ? Now i can attach any type of file to an item . But i want to restrict the user to upload only images. If user will upload any other then i want to display an error
message . Also how can i restrict the user to upload maximum one file only to a particular item?

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

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

发布评论

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

评论(1

柠檬色的秋千 2024-08-28 01:29:42

最好的前进方式确实是 创建事件接收器 并迭代项目的 Attachments 属性以查看已上传的内容。

在 SharePoint 2007 中,您只能返回简单的错误消息。在 SharePoint 2010 中,这一点得到了很大改进。

如果您不想创建新的 Visual Studio 项目,那么您还可以考虑使用 Sharepoint Designer 工作流程来实现相同的目的。 查看这篇文章,其中显示文件上传后如何进行一些基本验证。

The best way forward really is to create an event receiver and iterate through the item's Attachments property to see what has been uploaded.

In SharePoint 2007 you can only return simple error messages. In SharePoint 2010 this has been much improved.

If you don't want to create a new Visual Studio project then you can also consider a Sharepoint Designer workflow to achieve the same. Check out this article which shows how to do some basic validation when a file has been uploaded.

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