Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialized TodoTask is not understood by server #495

Closed
gaspik opened this issue Jul 20, 2022 · 3 comments
Closed

Serialized TodoTask is not understood by server #495

gaspik opened this issue Jul 20, 2022 · 3 comments
Assignees
Labels
Bug Something isn't working Kiota Is solved by Kiota or will be addressed in Kiota

Comments

@gaspik
Copy link

gaspik commented Jul 20, 2022

Describe the bug
TodoTask is serialized in a way that the server does not understand it

To Reproduce
Create new TodoTask and try to add it to existing task list. Example code:

var todoTask = new TodoTask
			{
				Title = "SampleTitle",
				Body = new ItemBody()
				{
					ContentType = BodyType.Html,
					Content = "SampleHtml"
				}
			};

await GraphServiceClient.Me
					.Todo
					.Lists[uniqueId]
					.Tasks
					.PostAsync(todoTask , cancellationToken: cancellationToken);

This gets serialized as following:

{
    "@odata.type": "#microsoft.graph.todoTask",
    "body": {
        "content": "SampleHtml",
        "contentType": "html",
        "@odata.type": "#microsoft.graph.itemBody"
    },
    "title": "SampleTitle"
}

And server replies with

{
    "error": {
        "code": "invalidRequest",
        "message": "One or more errors occurred. (One or more errors occurred. (A type named 'microsoft.toDo.todoTask' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.))",
        "innerError": {
            "code": "InvalidModel",
            "date": "2022-07-20T13:52:13",
            "request-id": "e4ad2f1c-a189-4ee5-80ef-0124626352d1",
            "client-request-id": "e4ad2f1c-a189-4ee5-80ef-0124626352d1"
        }
    }
}

Removing both odata.type resolves the issue. This was working in 5.8.0-preview, so I assume this has to do with #493

Expected behavior
TodoTask is properly created

Client version
5.10.0-preview

Desktop (please complete the following information):

  • OS: Win 10 x64
  • Browser: N/A, WinForms application using standard HttpClient
  • Version: N/A
@ghost ghost added the Needs: Triage label Jul 20, 2022
@andrueastman andrueastman added Bug Something isn't working Kiota Is solved by Kiota or will be addressed in Kiota and removed Needs: Triage labels Jul 21, 2022
@andrueastman andrueastman self-assigned this Oct 4, 2022
@Manav-Seth
Copy link

I see the same issue on version 5.12.0-preview as well. Reverted back to 5.8.0-preview for now.

@martin-ixzal-com
Copy link

martin-ixzal-com commented Oct 21, 2022

Also the same issue in 5.13.0-preview.

      var newTodoTask = new TodoTask
      {
        Title = NEW_TODOTASK_TITLE,
        Body = new ItemBody { Content = "-", ContentType = BodyType.Text },
      };

      newTodoTask = await graphClient.Me.Todo.Lists[taskList.Id].Tasks.PostAsync(newTodoTask).ConfigureAwait(true);   

ex.Message: Exception of type 'Microsoft.Graph.Beta.Models.ODataErrors.ODataError' was thrown.

ex.Source: Microsoft.Kiota.Http.HttpClientLibrary
ex.Error.Message: One or more errors occurred. (One or more errors occurred. (A type named 'microsoft.toDo.todoTask' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.))

Edit: Fixed in 5.14.0-preview.

@andrueastman
Copy link
Member

Thanks for your patience with this issue.

This should now be resolved with the latest 5.14.0-preview version

@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working Kiota Is solved by Kiota or will be addressed in Kiota
Projects
None yet
Development

No branches or pull requests

4 participants