Hello Dear Friends,
I am facing a problem and need your help .
i want to start SharePoint 2013 workflow from SharePoint Server OM.
current user do not have permissions to start workflow.
so i want to start from an elevated web.
please help me how i can achieve.
here is the code what i have writen.
var workflowServiceManager = new WorkflowServicesManager(web);
var workflowSubscriptionService = workflowServiceManager.GetWorkflowSubscriptionService();
//get all workflows associated with the list
//get lsit
SPList list = web.Lists["Leave"];
if (list != null)
{
var subscriptions = workflowSubscriptionService.EnumerateSubscriptionsByList(list.ID);
//run all workflows associated with the list
SPListItem item = list.GetItemById(Convert.ToInt32(drpRequest.SelectedValue));
foreach (var workflowSubscription in subscriptions)
{
//initiation parameters
var inputParameters = new Dictionary<string,
object>();
//inputParameters.Add("List", leaveList.ID);
workflowServiceManager.GetWorkflowInstanceService().StartWorkflowOnListItem(workflowSubscription,
item.ID, inputParameters);
}
}
Mukesh