'OneDrive Graph API - Checkin and Checkout not working

I'm trying to use OneDrive with GraphApi to read items, upload items etc via C# and all works great.

I'm following this. https://docs.microsoft.com/en-us/graph/api/driveitem-checkin?view=graph-rest-1.0&tabs=csharp

  [HttpPost]
  public async Task<IActionResult> Checkin(string Id)
  {
     //Id looks like this: B381F21397737D41!111

     var itemInfo = Id.Split('!');
     var versions = _graphServiceClient.Me.Drive.Items[Id].Versions.Request().GetAsync().Result;
     var permissions = _graphServiceClient.Me.Drive.Items[Id].Permissions.Request().GetAsync().Result;
     var drives = _graphServiceClient.Me.Drives.Request().GetAsync().Result;
  
     var comment = "Updating with the latest.";
     await _graphServiceClient.Drives[itemInfo[0]].Items[itemInfo[1]]
        .Checkin(null, comment)
        .Request()
        .PostAsync();

     return RedirectToAction("Index");
  }

But when I do Checkin or Checkout, it shows this error. All goes well till it gets to the async 'checkin' part.

ServiceException: Code: invalidRequest Message: API not found Inner 

error: AdditionalData: date: 2022-05-24T08:14:59 request-id: edac8ef2-13f5-46c9-aa1f-dcef248427aa client-request-id: edac8ef2-13f5-46c9-aa1f-dcef248427aa ClientRequestId: edac8ef2-13f5-46c9-aa1f-dcef248427aa
Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)

Error in full

Is this because the checkin/checkout is only supported for the beta endpoint ?

Any help appreciated !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source