3

I created a new file in a document library. The file will usually overwrite an existing file and for that process to happen, the file will need to be checked out.

The problem is when I call the checkIn end point, the file does not checkin. Even if I call it multiple times. It does not return any error, but the file remains checked out to myself.

Here is the query I am running:

https://SHAREPOINTURL/_api/web/getfilebyserverrelativeurl('/sites/demo007/pages/default.aspx')/checkIn(comment='Checked in during migration.',checkintype=1)

The required headers for POST request are also in place, considering I recently created that file.

  • 1
    Please share your code – Robert Lindgren Jul 20 '16 at 11:53
  • Added the query to the question – prog_24 Jul 20 '16 at 11:56
  • I couldn't get to work with REST, but did not try long enough because I had a JSOM solution working, with JSOM it is .checkIn( [text] , [majorversion] ) followed by .publish( [Text] ) Maybe REST needs 2 calls as well? – Danny '365CSI' Engelman Jul 20 '16 at 12:04
  • I have chained checkIn and Publish in my code. $newFile->checkIn(trans('app.checkin_message'), 1); $newFile->publish(trans('app.checkin_message')); No difference – prog_24 Jul 20 '16 at 12:12
3

Turns out, the comment is very important. My previous comment was "Checked in during Migration." I believe the extra "." was causing the issue. When I changed the checkin comment to "Migration", it worked.

The checkin endpoint does not like any special characters including spaces. The same goes for the approve and publish endpoints. "Migration-Message" seems to work fine.

Keep the comment simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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