question

MaheshTibrewal-2472 avatar image
0 Votes"
MaheshTibrewal-2472 asked saldana-msft edited

Unable to create ToDo Task using Graph API v1.0

I am trying to use the ToDo Task feature of graph api v1.0 to create a task using the following code

 var result = graphServiceClient.Users[outlookUserId].Todo.Lists[listid].Tasks.Request().AddAsync(todoTask).Result;

However, I am getting the following the error:

Code: invalidRequest
Message: 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.
Inner error:
Code: InvalidModel
AdditionalData:
date: 2020-11-25T09:41:04
request-id: 39794548-8f63-443e-a8bc-76ad6091dc8d
client-request-id: 39794548-8f63-443e-a8bc-76ad6091dc8d
ClientRequestId: 39794548-8f63-443e-a8bc-76ad6091dc8d

To resolve above, I had set the odatatype of todoTask to null, but got another exception:

Code: invalidRequest
Message: A type named 'microsoft.toDo.dateTimeTimeZone' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
Inner error:
Code: InvalidModel
AdditionalData:
date: 2020-11-25T09:43:27
request-id: 0780add8-3f17-40c5-a92b-e9e62ad08bf8
client-request-id: 0780add8-3f17-40c5-a92b-e9e62ad08bf8
ClientRequestId: 0780add8-3f17-40c5-a92b-e9e62ad08bf8

To resolve above I set the odatatype of all data members of todoTask of type DateTimeZone to null, but then getting the following exception:

Code: invalidRequest
Message: A type named 'microsoft.toDo.itemBody' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
Inner error:
Code: InvalidModel
AdditionalData:
date: 2020-11-25T09:46:11
request-id: 5bafbcab-5090-47b5-ac8e-8c96ec1d6592
client-request-id: 5bafbcab-5090-47b5-ac8e-8c96ec1d6592
ClientRequestId: 5bafbcab-5090-47b5-ac8e-8c96ec1d6592

To resolve above, I set the odatatype of todoTask body to null, but now I am getting following exception which I am unable to resolve:

Code: generalException
Message: Internal Server Error
Inner error:
AdditionalData:
date: 2020-11-25T09:48:23
request-id: f5d52f43-c0b4-425e-83ec-652fadb7abf9
client-request-id: f5d52f43-c0b4-425e-83ec-652fadb7abf9
ClientRequestId: f5d52f43-c0b4-425e-83ec-652fadb7abf9

For our application, we need to create task and sync to outlook and since, this will go into production, we cannot use the beta version. Can anybody please help me in saving the task.




microsoft-graph-sdkmicrosoft-graph-todo
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I haven't tested with SDK. Being said that I tested with Microsoft Graph Explorer/POSTMAN but i failed to repro the issue.

0 Votes 0 ·

I am also facing the same issue. Didn't get any resolution for this.

0 Votes 0 ·

@Deva-MSFT I tried with the latest SDK, but still facing the same issue.

0 Votes 0 ·

For reference, below is the code on how I am setting up the TodoTask object:

 var todoTask = new TodoTask();
 todoTask.Title = "Subject";
 todoTask.DueDateTime = new DateTimeTimeZone() { DateTime = dueDate.Date.ToString()};
 todoTask.Status = TaskStatus.NotStarted;
 todoTask.Importance = Importance.Normal;
 todoTask.Body = new ItemBody
 {
      Content = "Test",
      ContentType = BodyType.Text
 };
 todoTask.IsReminderOn = true;
 todoTask.ReminderDateTime = new DateTimeTimeZone() { 
      DateTime = reminderTime.Value.ToString() };
 todoTask.Extensions = new TodoTaskExtensionsCollectionPage();
 todoTask.Extensions.Add(new OpenTypeExtension{
      ExtensionName = "TestProperty", 
      AdditionalData = new Dictionary<string,object>{
                    {"MyProp","MyValue"}}});
0 Votes 0 ·
Deva-MSFT avatar image Deva-MSFT MaheshTibrewal-2472 ·

Thanks. Let me look into this.

0 Votes 0 ·
Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered DeanKinane-5406 commented

Here's the related info on this.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can we get some input on this please?

This is a major blocker for us as we've been moving our CRMs integration from EWS to Graph and this is holding the project up now.
Would appreciate some assistance.

Thanks.

1 Vote 1 ·

Hi Deva

I'm experiencing the same issue with the latest SDK.

I'm reviewed the related issue you linked but it did not resolve my issue.

No matter what I pass to the SDK it always returns:
"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."

Is there something I'm missing?

Thanks.



0 Votes 0 ·
SunilSingh-6229 avatar image
0 Votes"
SunilSingh-6229 answered

I am also facing the same issue

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RudyDeMaeyer-6857 avatar image
0 Votes"
RudyDeMaeyer-6857 answered

Same here. This is a major block in our progress. We already successfully managed integration of calendar events, and assumed the todotasks would work too...

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.