0

I'm updating a file that contains versioning and previously it stated that the document requires checking out to edit so I run the following code that results with the same error:

if (oCurrent.File.CheckOutType.ToString() == "None")
{
    oCurrent.File.CheckOut();
    oCurrent["Tasks Generated"] = "true";
    oCurrent.File.CheckIn("Automated Tasks Generated by Event Handler");
    oCurrent.Update();

    GenerateTasksForNewDocument(oCurrent, ocollCirculation);
}

The file "../sample.txt" is not checked out. You must first check out this document before making changes.

In addition, when changing the code to the following, I get a similar error:

oCurrent.SystemUpdate();

The file International Standards/sample2.txt has been modified by ..\matt on 21 Apr 2015 15:09:26 +0100

How can I get around this as I'm checking the document out already?

Let me know if you need any more information

1 Answer 1

0

Try updating the item before checking it back in.

if (oCurrent.File.CheckOutType.ToString() == "None")
{
    oCurrent.File.CheckOut();
    oCurrent["Tasks Generated"] = "true";
    oCurrent.Update();
    oCurrent.File.CheckIn("Automated Tasks Generated by Event Handler");        

    GenerateTasksForNewDocument(oCurrent, ocollCirculation);
}
1
  • 1
    that's done it. can't believe I missed the logic with that. thank you.
    – matt
    Apr 21, 2015 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.