6

Im tryin to do checkin major version through REST API.

This url is working just fine and I can do minor version checked in

/sites/developersite/_api/web/GetFolderByServerRelativeUrl('Document')/Files/GetByUrl('file.docx')/CheckIn('Comment')

but I cant get this one working

/sites/developersite/_api/web/GetFolderByServerRelativeUrl('Document')/Files/GetByUrl('file.docx')/CheckIn('Comment', 1)

Argument 1 suppose to be major version checkin type.

Documentation on MSDN says that second url should be working.

Error that Im getting when second url is used

{
"error":{
   "code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
   "message":{
      "lang":"en-US",
      "value":"The expression \"web/GetFolderByServerRelativeUrl('Documents')/Files/GetByUrl('file.docx')/CheckIn('Comment',1)\" is not valid."
        }
    }
 }
5

I haven't done that with REST before, but in this article he uses this syntax:

http://<site url>/_api/web/GetFileByServerRelativeUrl(
  '/Shared Documents/a.txt')/CheckOut()
http://<site url>/_api/web/GetFileByServerRelativeUrl(
  '/Shared Documents/a.txt')/CheckIn(comment='Comment', checkintype=0)

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.