Which is the best way to display a custom form for each new document being added to a specific document library?
哪个是为添加到特定文档库的每个新文档显示自定义表单的最佳方法?
I want the user to have some control over some actions that adding the document will cause - specifically, tasks created for users in a Task List, which the contributing user will have to OK before committing.
我希望用户能够控制添加文档会导致的某些操作 - 特别是在任务列表中为用户创建的任务,贡献用户在提交之前必须确定。
Is the best way to do this via a Workflow or an event handler?
是通过工作流程或事件处理程序执行此操作的最佳方法吗?
Regards Moo
4 个解决方案
#1
0
For SharePoint server 2007:
对于SharePoint Server 2007:
A combination of a specialised content type and an event handler will give you the most control of the process (easier to debug too). A workflow is best for "easy" actions and is harder to make complex actions happen.
专用内容类型和事件处理程序的组合将使您能够最好地控制该过程(也更容易调试)。工作流程最适合“简单”操作,并且更难以执行复杂操作。
A workflow allows for more flexibility in assigning the workflow to different libraries by site admins.
工作流程允许站点管理员更灵活地将工作流分配给不同的库。
Roll your content type and event handler into a feature that can be deployed. Assigning the content type to a list will allow you to take any data created by the standard form (remember you can create custom fields for really complex/custom data entry) and take any action required, including creating tasks based on the item.
将内容类型和事件处理程序转换为可以部署的功能。将内容类型分配给列表将允许您获取标准表单创建的任何数据(请记住,您可以为真正复杂/自定义数据输入创建自定义字段)并执行所需的任何操作,包括基于项目创建任务。
#2
0
Thanks for the answer, thats the route I was investigating but unfortunately I haven't found a way to make it work for Document Libraries - only Lists.
谢谢你的回答,这就是我正在调查的路线,但不幸的是我还没有找到一种方法让它适用于文档库 - 只有列表。
The problem I have come across is that aving a SPUtility.Redirect in the ItemAdded, ItemAdding, ItemCheckingIn or ItemCheckedIn event on the document library doesn't do anything at all, because there is no page related to the events - its all backend code being fired that is not linked to a web context, because its not the webpage doing the heavy lifting at that point but the Office integration.
我遇到的问题是文档库中的ItemAdded,ItemAdding,ItemCheckingIn或ItemCheckedIn事件中的SPUtility.Redirect完全没有做任何事情,因为没有与事件相关的页面 - 它的所有后端代码都是没有链接到Web上下文的被解雇,因为它不是网页在那时做了繁重但是Office集成。
All of the examples I have come across seem to rely on the fact that the EditForm.aspx or NewForm.aspx page is being displayed at the time the event is fired, which of course is not the case here.
我遇到的所有示例似乎都依赖于事件被触发时显示EditForm.aspx或NewForm.aspx页面的事实,当然这不是这种情况。
This also leads to the problem that I cannot extend the EditForm.aspx or the CheckIn.aspx page to do what I want either, because Office 2007 circumvents both of these.
这也导致了我无法扩展EditForm.aspx或CheckIn.aspx页面以执行我想要的操作的问题,因为Office 2007会绕过这两者。
So, the only option left open to me at the moment is doing it through a workflow :/
那么,目前唯一可以选择通过工作流程完成的选项:/
Any further tips would be fantastic.
任何进一步的提示都会很棒。
#3
0
I may not understand your question, but is this close to what you're trying to do?
我可能不理解你的问题,但这是否接近你想要做的事情?
http://msdn.microsoft.com/en-us/library/ms550037.aspx
If not, in what way does this come up short?
如果没有,这会以什么方式出现?
#4
0
A new "Content Type" with its New Form url set to the appropriate value should do the trick. Unfortunately you may not be able to achieve what you are trying to with an Event Handler or a Workflow. You would ideally want the form to show up as soon as the user adds a new item to the library and a custom content type will do the trick.
将新表单URL设置为适当值的新“内容类型”应该可以解决问题。不幸的是,您可能无法通过事件处理程序或工作流来实现您的目标。理想情况下,只要用户将新项目添加到库中,并且自定义内容类型可以完成操作,您就会希望表单显示出来。
- Create a new Content Type. (Derive it from the existing Content Type)
- Remove the default content type from the doc library.
- Using the Object Model to set the New Form url to an aspx page or an Infopath form you've created.
创建新的内容类型。 (从现有的内容类型中导出)
从文档库中删除默认内容类型。
使用对象模型将新表单URL设置为您创建的aspx页面或Infopath表单。
Kind regards,
#1
0
For SharePoint server 2007:
对于SharePoint Server 2007:
A combination of a specialised content type and an event handler will give you the most control of the process (easier to debug too). A workflow is best for "easy" actions and is harder to make complex actions happen.
专用内容类型和事件处理程序的组合将使您能够最好地控制该过程(也更容易调试)。工作流程最适合“简单”操作,并且更难以执行复杂操作。
A workflow allows for more flexibility in assigning the workflow to different libraries by site admins.
工作流程允许站点管理员更灵活地将工作流分配给不同的库。
Roll your content type and event handler into a feature that can be deployed. Assigning the content type to a list will allow you to take any data created by the standard form (remember you can create custom fields for really complex/custom data entry) and take any action required, including creating tasks based on the item.
将内容类型和事件处理程序转换为可以部署的功能。将内容类型分配给列表将允许您获取标准表单创建的任何数据(请记住,您可以为真正复杂/自定义数据输入创建自定义字段)并执行所需的任何操作,包括基于项目创建任务。
#2
0
Thanks for the answer, thats the route I was investigating but unfortunately I haven't found a way to make it work for Document Libraries - only Lists.
谢谢你的回答,这就是我正在调查的路线,但不幸的是我还没有找到一种方法让它适用于文档库 - 只有列表。
The problem I have come across is that aving a SPUtility.Redirect in the ItemAdded, ItemAdding, ItemCheckingIn or ItemCheckedIn event on the document library doesn't do anything at all, because there is no page related to the events - its all backend code being fired that is not linked to a web context, because its not the webpage doing the heavy lifting at that point but the Office integration.
我遇到的问题是文档库中的ItemAdded,ItemAdding,ItemCheckingIn或ItemCheckedIn事件中的SPUtility.Redirect完全没有做任何事情,因为没有与事件相关的页面 - 它的所有后端代码都是没有链接到Web上下文的被解雇,因为它不是网页在那时做了繁重但是Office集成。
All of the examples I have come across seem to rely on the fact that the EditForm.aspx or NewForm.aspx page is being displayed at the time the event is fired, which of course is not the case here.
我遇到的所有示例似乎都依赖于事件被触发时显示EditForm.aspx或NewForm.aspx页面的事实,当然这不是这种情况。
This also leads to the problem that I cannot extend the EditForm.aspx or the CheckIn.aspx page to do what I want either, because Office 2007 circumvents both of these.
这也导致了我无法扩展EditForm.aspx或CheckIn.aspx页面以执行我想要的操作的问题,因为Office 2007会绕过这两者。
So, the only option left open to me at the moment is doing it through a workflow :/
那么,目前唯一可以选择通过工作流程完成的选项:/
Any further tips would be fantastic.
任何进一步的提示都会很棒。
#3
0
I may not understand your question, but is this close to what you're trying to do?
我可能不理解你的问题,但这是否接近你想要做的事情?
http://msdn.microsoft.com/en-us/library/ms550037.aspx
If not, in what way does this come up short?
如果没有,这会以什么方式出现?
#4
0
A new "Content Type" with its New Form url set to the appropriate value should do the trick. Unfortunately you may not be able to achieve what you are trying to with an Event Handler or a Workflow. You would ideally want the form to show up as soon as the user adds a new item to the library and a custom content type will do the trick.
将新表单URL设置为适当值的新“内容类型”应该可以解决问题。不幸的是,您可能无法通过事件处理程序或工作流来实现您的目标。理想情况下,只要用户将新项目添加到库中,并且自定义内容类型可以完成操作,您就会希望表单显示出来。
- Create a new Content Type. (Derive it from the existing Content Type)
- Remove the default content type from the doc library.
- Using the Object Model to set the New Form url to an aspx page or an Infopath form you've created.
创建新的内容类型。 (从现有的内容类型中导出)
从文档库中删除默认内容类型。
使用对象模型将新表单URL设置为您创建的aspx页面或Infopath表单。
Kind regards,