简体   繁体   中英

"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.

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. This should return an int32 that can later be used by LookupSPUser to get the user's email. Unfortunately, "Created by" is returning a 0 which causes LookupSPUser to fail and the workflow to exit/crash. 在此处输入图片说明

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. All 3 "Assign To" fields are 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?

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. 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. If I ever find out what the sharePoint team changed, I will post it here. The SharePoint team told me I should start over using SharePoint designer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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