简体   繁体   English

作为 SharePoint 加载项服务器端运行的 C# 工作流中的“创建者”返回 0,而不是包含 ID 的 int32

[英]"Created By" in C# workflow running as SharePoint add-in server side returns 0 not int32 containing the ID

I am using visual studio 2019, to create a SharePoint add-in running on the server.我正在使用 Visual Studio 2019 创建在服务器上运行的 SharePoint 加载项。

I am working on a simple form.我正在制作一个简单的表格。 When the status field is set to reject the workflow should send an email to the creator informing them so they can make the required changes for approval.当状态字段设置为拒绝时,工作流应向创建者发送电子邮件通知他们,以便他们可以进行所需的更改以供批准。 In the workflow I use GetDFynamicProperties to get the "Created by" field.在工作流中,我使用 GetDFynamicProperties 来获取“创建者”字段。 This should return an int32 that can later be used by LookupSPUser to get the user's email.这应该返回一个 int32,以后 LookupSPUser 可以使用它来获取用户的电子邮件。 Unfortunately, "Created by" is returning a 0 which causes LookupSPUser to fail and the workflow to exit/crash.不幸的是,“创建者”返回 0,这会导致 LookupSPUser 失败并且工作流退出/崩溃。 在此处输入图片说明

Above you see the user lookup I am using.在上面您可以看到我正在使用的用户查找。 "TQM Service Request" is the name of the list that contains all the fields for the form. “TQM 服务请求”是包含表单所有字段的列表名称。 All 3 "Assign To" fields are int32.所有 3 个“分配给”字段都是 int32。 The step below sends an email with the 3, for debugging, so I know all 3 end with a value of 0. Any thoughts on why "Created by" returns 0?下面的步骤发送一封带有 3 的电子邮件,用于调试,所以我知道所有 3 的值都为 0。关于为什么“创建者”返回 0 的任何想法?

I have an answer that no one will like.我有一个没人会喜欢的答案。 I suspect the SharePoint team changed something because I changed nothing and suddenly the code started working as designed.我怀疑 SharePoint 团队改变了一些东西,因为我什么都没做,突然代码开始按设计工作。 Now when the status is set to rejected the userID variable is populate with an int32 value and that value is used by LookupSPUser to get the email of the person who completed the form and that person receives an email notification stating they need to update the form.现在,当状态设置为拒绝时,userID 变量将填充一个 int32 值,LookupSPUser 使用该值来获取完成表单的人的电子邮件,并且该人会收到一封电子邮件通知,说明他们需要更新表单。 If I ever find out what the sharePoint team changed, I will post it here.如果我发现 sharePoint 团队更改了什么,我会在这里发布。 The SharePoint team told me I should start over using SharePoint designer. SharePoint 团队告诉我应该重新开始使用 SharePoint 设计器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM