R – get the Publishing Page Approver and Page Status in workflow

sharepointsharepoint-2007workflow

I want to develop a workflow for a SharePoint Publishing Page Library.

When someone approves the page, I want to trigger this workflow and record the approver name, URLl and page status to a custom database.

How can I get approver name and page status? Could you please advise me?

This is my current testing code:

public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();

public Guid Task1_Id = default(System.Guid);
public SPWorkflowTaskProperties Task1_Properties = new SPWorkflowTaskProperties();

public CodeGenWorkflow()
{
    InitializeComponent();
}

private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
    int i = 0;

    string url = workflowProperties.Web.Url + "/" + workflowProperties.Item.File.Url;
    Task1_Properties.TaskType = 1;

    //bool task1Approved = bool.Parse(Task1_Properties.ExtendedProperties["approved"].ToString());
}

Best Answer

You can use a custom ItemUpdated event handler on the workflow task list, and if properties.ListItem["Status"].ToString().Equals("Approved"), grab the task status and AssignedTo column value and pass it to your database.

If you need any values from the source list item, use properties.ListItem["Workflow List ID"] to get the guid value of the source list, and properties.ListItem["Workflow Item ID"] to get the int value of the source list item.

Related Topic