这些是我在表单库中的ItemUpdating事件接收器中获得的结果:
properties.BeforeProperties["CurrentUser"] returns null
properties.AfterProperties["CurrentUser"] returns null
properties.ListItem["CurrentUser"] returns the old value
如何将旧值与使用infopath作为表单的SharePoint表单库中的新值进行比较?
我见过this site,但它并没有帮助我解决问题。
答案 0 :(得分:1)
我能够弄明白我的问题。这就是你能做的。在上面的链接中,您可以参考以找出要使用的属性,具体取决于您使用库或列表的内容。
就我而言,我使用的是图书馆。记住这一点,在大多数博客中写道,你应该使用该字段的InternalName,但对我来说它是不同的。我使用DisplayName,它工作。请尝试在代码中使用显示名称。如果它不起作用,那么尝试内部名称。正如我上面所说的显示名称为我做了诀窍。
以下是示例:
InternalName: Current_x0020_User
DisplayName: Current User
public override void ItemUpdating(SPItemEventProperties properties)
{
properties.BeforeProperties["Current User"] //use the Display Name
properties.AfterProperties["Current User"] //use the display name
properties.ListItem["Current User"] // use the display name
}
如果这有助于你,请告诉我