I am using the following code to update the list item and trigger the workflow. But the workflow is not triggering when the item is updated. Any thoughts on this.
using (SPSite site = new SPSite("http://spweb02:91/test"))
{
using (SPWeb web = site.OpenWeb())
{
SPUserToken tokentemp = web.SiteUsers[@"i:0#.w|testdomain\" + "gs-test-r"].UserToken;
using (SPSite sitetemp = new SPSite("http://spweb02:91/test", tokentemp))
{
using (SPWeb webtemp = sitetemp.OpenWeb())
{
try
{
sitetemp.AllowUnsafeUpdates = true;
webtemp.AllowUnsafeUpdates = true;
SPList parentlist = webtemp.Lists["Test"];
SPListItem parent = parentlist.Items[0];
parent["Title"] = DateTime.Now.ToString();
parent.Update();
webtemp.AllowUnsafeUpdates = false;
sitetemp.AllowUnsafeUpdates = false;
}
catch (Exception ex)
{
}
}
}
}
}