views:

256

answers:

2

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());
}
A: 

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.

Ajay Nayak
A: 

Thanks Ajay, I believe your logic will work, because ListItem include many information that I wanna get... ^o^

I will take a in-deep investigation for this, many thanks for you.

August