c# - Sharepoint Online Workflow restart error (Console Application) -


i requests restart workflow of list items. have written application takes library name , list item name input. when try start workflow (startworkflow method) error exception hresult: 0x8102009b , no inner exception. below code.

sometimes workflow may have been started. in case need cancel workflow , restart.

i did lot of search on issue. of resolution sp 2010. using sp online

clientcontext.credentials = new sharepointonlinecredentials(userid, password); var web = clientcontext.web; list list = web.lists.getbytitle("listname"); clientcontext.load(list);                  camlquery camlquery = new camlquery(); camlquery.viewxml = "<view><query><orderby><fieldref name='fileleafref' descending='true'/></orderby><where><eq><fieldref name='fileleafref'/><value type='file'>" + listitemname + ".xml</value></eq></where></query><rowlimit>1</rowlimit></view>";                 listitemcollection items = list.getitems(camlquery); clientcontext.load(items);                 clientcontext.executequery();                  var id = items.where(a => a.fieldvalues["fileleafref"].tostring() == listitemname + ".xml").select(a => a.id).firstordefault(); guid listitemid = (guid)items.where(a => a.fieldvalues["fileleafref"].tostring() == listitemname + ".xml").select(a => a.fieldvalues["guid"]).firstordefault();  workflowassociationcollection wfacollection = items.where(a => a.fieldvalues["fileleafref"].tostring() == listitemname + ".xml")                                                 .select(a => a.parentlist.workflowassociations).firstordefault(); clientcontext.load(wfacollection);                  var workflowservicemanager = new workflowservicesmanager(clientcontext, web); clientcontext.load(workflowservicemanager);                 clientcontext.executequery();      interopservice workflowinteropservice = workflowservicemanager.getworkflowinteropservice(); clientcontext.load(workflowinteropservice);                   var wfaname = wfacollection.where(a => a.enabled == true).select(a => a.name).firstordefault(); guid wfaid = wfacollection.where(a => a.enabled == true).select(a => a.id).firstordefault(); var initiationdata = new dictionary<string, object>();  clientresult<guid> resultguid = workflowinteropservice.startworkflow(wfaname, new guid(), list.id, listitemid, initiationdata);  clientcontext.executequery(); 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -