So I like many have a workflow that takes requests for Sites with a bunch of details for costing etc. Then when approved those Sites are created and permissions allocated.
What we did not have was a record of who actually approved the sites. Whilst this info is in the workflow history after a while that information gets purged, leaving us with Sites that were approved but by whom we know not.
So this is a simple case of changing the workflow and recording all of the approvers in the SPWeb properties, except that the approvers as we can tell happen to be Sharepoint Groups or AD groups, neither of which contain a history of membership, if AD does none I know how to access and certainly not easy for the customer and in a large membership we still would not know who actually did the deed.
I dug and dug for this and eventually found the User Login that actually did the change and here is how.
In your workflow you need a “Workflow Action” of EventName “OnTaskChanged”, this object in the code behind, when Invoked contains AfterProperties,
string user = OnApprovalTaskChanged.AfterProperties.ExtendedProperties[new Guid(“d31655d1-1d5b-4511-95a1-7a09e9b75bf2”)].ToString();
The above statement gets the User Login frmo the ExtendedProperties Collection. It Stores the User under the key of that Guid in a User type field that refers to the Editor.
A list of fields can be found here .
So that’s it, took a lot of debugging and poking about but next time your looking for the actual approving user, take a look here.