SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a list "Modification Log".Then a workflow for ADD and EDIT.How Can I get "Deleted By" like "Created By" and "Modified By".Please help to have a solution for delete also. This is my code

private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e) {

        SPWeb oSPWeb = workflowProperties.Web;

        oSPWeb.AllowUnsafeUpdates = true;

        SPList oSPList = oSPWeb.Lists["Modification Log"];

        SPListItem oSPListItem = workflowProperties.Item;

        SPListItem oSPListItm = oSPList.Items.Add();

        oSPListItm["Project Code"] = oSPListItem["Project Code"];

        oSPListItm["Project Details"] = oSPListItem["Project Details"];

        oSPListItm["Resource Name"] = oSPListItem["Resource Name"];

        oSPListItm["Department"] = oSPListItem["Department"]; 

        if (Convert.ToString(oSPListItem["Modified By"]) != string.Empty)

            oSPListItm["Operation Done By"] = oSPListItem["Created By"];

            oSPListItm["Operation"] = "ADD";


            oSPListItm["Operation Done By"] = oSPListItem["Modified By"];

            oSPListItm["Operation"] = "EDIT";


        oSPWeb.AllowUnsafeUpdates = false;
share|improve this question

If you really want to get a log of all events in the list you should look on the audit capabilities in SharePoint. There's a ready infrastructure for it but you have to write code to enable it and to view the reports. See the details here. It's about MOSS 2007 but it works identically in all the editions of SharePoint 2007 and 2010. It allows to view the delete events among many others.

share|improve this answer
I would add that while the reports and user interface for setting auditing up are not very good, the API is fairly well built. – Andy Burns Mar 6 '12 at 12:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.