问题标签 [event-receiver]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - 如何以编程方式创建事件接收器?
我们正在以编程方式创建内容数据库、网站集和库。然后我们在文档库中上传文档。一旦以编程方式创建列表,我们想在 C# 中以编程方式(不使用 Visual Studio)创建事件接收器?还想以编程方式激活它们。有没有办法做到这一点?您能否提供任何代码,通过它我将获得分步指南?
sharepoint - sharepiont 2010 sandboxed ItemUpdating event receiver triggered only on first 3 items
I have 2 Lists:
List A
- Title
- Category (lookup to Category List) (choices A, B C)
- Price (number field)
- Category Total (number field)
- ...Some other fields
List B
- Title
- CategoryA Price (number field)
- CategoryB Price (number Field)
- CategoryC Price (number field)
- Changes Pending (bool / checkbox, default "no")
- ...Some other fields
List B has itemUpdating event receiver that goes to List A, and gets the price, does some calculations and saves that price in the CategoryX Price field before setting "pending changes" to false. This works fine when triggered from List B.
List A also has itemUupdating and itemUpdated event receivers. When I change Price, itemUpdating loops through List A and sums up the Prices for the same category and saves it in Category Total for all items with the same category. ItemUpdated goes to List B and sets "Changes Pending=yes" on items with the same category. Event firing is enabled on purpose so that list B itemUpdating fires and refreshes itself with new Price from List A.
Problem: When I change the Price in list A, only the first 3 items in list B get updated properly. (there is around 15 items to be updated). How can I ensure that list B event receivers completed for all items? (additionally, when I attach debugger to list B itemUpdating and change Price in List A, debugger never fires off and none of the items in list B get updated)
Environment SP 2010 Server on VM. VS2010 Sandboxed solutions (can't use farm). All event receivers have default sequence number. -ing events are synchronous and -ed events are asynchronous.
sharepoint-2010 - 此页面的安全验证无效错误尝试将共享点批准工作流添加到 ListAdded eventreceiver 中的列表
我想要做的是将 OOTB 共享点工作流 [Approval Sharepoint - 2010] 附加到每个创建的文档库中。为此,我创建了一个列表添加事件接收器并将此代码放入其中 -
我收到这个错误-
此页面的安全验证无效。在您的 Web 浏览器中单击返回,刷新页面,然后再次尝试您的操作。
在这条线上
docLib.WorkflowAssociations.Add(workFlow);
请问大家有什么建议吗?感谢您的反馈意见。
sharepoint - Sharepoint 2010 事件接收器和工作流未启动
我创建了一个应该触发 SharePoint 设计器工作流的事件接收器,但是这从未发生过。对于 guid 和工作流关联,这部分代码永远不会评估为 true:if (association.BaseId == workflowGuid)。我有点难过,不太确定为什么它不起作用。任何见解将不胜感激......我的代码如下。基本上,当一个项目添加到我的列表中时,它应该会触发我的 Sharepoint 设计器工作流程,但这永远不会发生,我可以手动启动工作流程。
sharepoint-2010 - SharePoint 2010 中事件接收器的自定义错误消息
我希望用户仅在文档库中上传 .doc 文件。
为此,我在 Visual Studio 2010 中开发了一个事件接收器。
我的代码如下:
此示例引用了代码。
我的问题是,当我上传非 doc 文件时,它会阻止但系统错误消息不是properties.ErrorMessage
.
我该如何解决这个问题?
请帮忙。
sharepoint - [SharePoint 2010]来自用户配置文件自定义字段的值返回 Null
在 EventReceiver 中,我在添加的项目上调用此方法GetPernNr:
其中assignedTo 是SPUser。
奇怪的是,当我尝试从 UserProfile (办公室、经理等)的默认字段中获取值时,此代码有效。当我在 EventReceiver 之外调用此方法时也有效,但在我的情况下,upUser["PersonNumber"].Value
返回 null。任何帮助都感激不尽
c# - 在 SharePoint 的 EventReceiver 中更正将文件写入磁盘的权限
我一直在 SharePoint 中处理 PoC,在EventReceiver
处理文档库中添加或更新的项目时,必须将文件复制到临时文件夹中。
我想知道,有没有办法知道哪个用户将在文件夹中写入文件?因为这可能在不同的服务器上工作,所以必须授予权限。
sharepoint-2010 - Sharepoint 2010 事件接收器 ItemUpdated 触发两次
我将三个事件附加到我的 CustomLists:
- 添加项目
- 物品已更新
- 项目删除
在一个列表上,我有一个工作流,它正在更改该列表中的列。因此,当我编辑该列表中的条目时,ItemUpdated-Event 会触发两次。在其他列表(没有任何工作流程)上,我的接收器工作正常。
如何确定工作流是否调用了我的事件接收器?
触发事件的工作流与触发事件的用户之间有区别吗?
c# - SPContext.Current.FormContext.OnSaveHandler 未从自定义字段类型控件触发
我遇到了与此处描述的完全相同的问题。不幸的是,因为我没有 50 分,但我无法对此发表评论,所以我必须创建一个新的重复问题。
我的意思是它不像其他人的问题那样“100% 完全正确”,因为对我来说问题存在于编辑表单上,我正在使用自定义表单和字段的组合。但是我根据这个站点上的人提出的建议 #2 在字段级别添加自定义保存事件处理程序。我还应该注意,当我创建一个没有任何自定义表单或内容类型的新文档库并直接使用我的自定义字段时,事件处理程序也不会触发。但是,如果我创建一个新的常规 SharePoint 列表并添加自定义字段,则 OnSaveHandler可以火!所以我不太清楚为什么它在文档库中不起作用,但它在列表中起作用,因为我的印象是自定义字段的美妙之处在于它们独立于其他所有内容运行。意思是,即使我用我的编辑表单或其他控件做了一些不正常的事情,因为我将我的自定义方法附加到我的自定义字段的 OnInit 方法中的SPContext.Current.FormContext.OnSaveHandler那么无论如何都应该触发!即使是第一次加载该字段时,我实际上也看到调试器中连接了该事件。在调试模式下,我在下面的“if”语句旁边有一个断点,它会命中该断点,这意味着当触发 FormContext.OnSaveHandler 时,我的方法应该触发。
有什么想法吗?建议?
谢谢!
更新#1:经过一些故障排除后,我能够推断出我的自定义字段中的 EventHandler 被触发但仅在常规列表而不是文档库中使用时!在常规 SharePoint 列表中,不仅会触发 SPContext.Current.FormContext.OnSaveHandler,还会保存自定义字段中的值。
附带说明一下,当将数据保存回从 SPFieldText 继承的自定义字段时,该值(即 json 数据)在列表视图中显示为#VALUE!,我认为这有点奇怪。我的意思是它能够正确读取存储在字段中的 json 数据,因为它可以很好地显示在编辑表单中。但出于某种原因,SharePoint 只是将其显示为#VALUE!在列表视图中。
c# - 如何在文件添加的 sharepoint 2013 上创建事件接收器更改权限
我有一个库(“文档”),我想在其中添加一个事件接收器,它将删除添加的项目的权限。我已经尝试了多种方法来做到这一点,但我没有那么实验,我不知道我错在哪里。使用以下代码,我设法 BreakInheritance,但没有设法删除所有assignmets 并添加一个新的。