Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SPFile.Publish changes Approval Status but workflow does not start

  Asked By: Joseph    Date: May 30    Category: Sharepoint    Views: 4367

I have configured the Approval workflow for a Wiki list. The
workflow is set to "Start this workflow to approve publishing a major
version of an item.". Versioning is set to creat major and minor

When I manually "Publish a Major Version" for a wiki page the
workflow starts OK, but when I use a webpart with this code it does
not start:

SPFile myFile = SPContext.Current.File;
myFile.Publish("A comment");

What happens is SharePoint changes the Approval Status for the page
from "Draft" to "Pending" but does not start the workflow.

Is there something else I need to do to start the actual workflow
programmatically, please?



2 Answers Found

Answer #1    Answered By: Daamodar Bhadranavar     Answered On: May 30

I haven't done this before, but usually you need to call the Update
method on SP objects that have been changed. SPFile does have an Update
method, so give it a try.

Answer #2    Answered By: Destiny Lewis     Answered On: May 30

Dont take this as gospel, but for some reason I think after SP1 that
if you are signed in as a "system account" that workflows will not
automatically fire.