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

Patching a TodoTask which has a Recurrence value fails #2677

Open
aaronsmithuk opened this issue Sep 23, 2024 · 3 comments
Open

Patching a TodoTask which has a Recurrence value fails #2677

aaronsmithuk opened this issue Sep 23, 2024 · 3 comments

Comments

@aaronsmithuk
Copy link

Describe the bug

I am trying to patch an existing TodoTask that has a recurrence value. It loads fine, but when I go to patch it (even with no changes), it results in:
Invalid JSON, Error converting value "2025-09-23" to type 'Microsoft.OData.Edm.Date'. Path 'recurrence.range.endDate', line 1, position 46.

Expected behavior

It should patch the TodoTask without error and set the Recurrence changes.

How to reproduce

TodoTask tdTemp = new();
tdTemp.Recurrence = new()
    {
        Range = new()
        {
            Type = RecurrenceRangeType.EndDate,
            StartDate = new(DateTime.Now),
            EndDate = new(DateTime.Now.AddYears(1))
        }
    };
var result = await GraphClient.Users[MSGraphId.ToString()].Todo.Lists[list.Id].Tasks[task.Id].PatchAsync(tdTemp);

SDK Version

5.58.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

Windows 11, x64.

### Other information

Someone else reported it here:
https://learn.microsoft.com/en-gb/answers/questions/806339/unable-to-patch-a-todo-task-with-a-recurrence-patt
@aaronsmithuk aaronsmithuk added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 23, 2024
@andrueastman
Copy link
Member

Thanks for raising this @aaronsmithuk

Any chance you can confirm if you can perform a successful update using the graph Explorer?

Taking a look at the issue at the link below, it may seem that the API may not support this. But it would be great to get confirmation on this.

https://learn.microsoft.com/en-us/answers/questions/806339/unable-to-patch-a-todo-task-with-a-recurrence-patt
microsoftgraph/microsoft-graph-toolkit#3182

@andrueastman andrueastman added Service issue status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Sep 24, 2024
@aaronsmithuk
Copy link
Author

Tried it with Graph Explorer, looks like it isn't supported.

PATCH: https://graph.microsoft.com/v1.0/me/todo/lists/AQMkAGU0NjIxNzVkLTBlNmItNDA2ZS1iMjhmLTI1OWE5NDZhMTEAYmYALgAAA_cL2sajUMNGojd_LMDC69oBADS8myQQQ2tPjwencXfyCmEAAAIBEgAAAA==/tasks/AAMkAGU0NjIxNzVkLTBlNmItNDA2ZS1iMjhmLTI1OWE5NDZhMTFiZgBGAAAAAADnC9rGo1DDRqI3fizAwuvaBwA0vJskEENrT48Hp3F38gphAAAAAAESAAA0vJskEENrT48Hp3F38gphAATprJd_AAA=

{
    "recurrence": {
        "pattern": {
            "type": "absoluteMonthly",
            "interval": 1,
            "month": 0,
            "dayOfMonth": 20,
            "daysOfWeek": [],
            "firstDayOfWeek": "sunday",
            "index": "first"
        },
        "range": {
            "type": "noEnd",
            "startDate": "2024-09-20",
            "endDate": "0001-01-01",
            "recurrenceTimeZone": "UTC",
            "numberOfOccurrences": 0
        }
    }
}
{
    "error": {
        "code": "invalidRequest",
        "message": "Invalid JSON, Error converting value \"2024-09-20\" to type 'Microsoft.OData.Edm.Date'. Path 'recurrence.range.startDate', line 1, position 197.",
        "innerError": {
            "code": "InvalidModel",
            "date": "2024-09-24T12:15:44",
            "request-id": "0fcfff48-ba8d-40a8-8c9a-bde199ee7d95",
            "client-request-id": "5c7103f4-15ad-3e89-75fa-f0ad42718ed3"
        }
    }
}

However, POST works fine, I can create a ToDoTask with recurrence, just can't PATCH it.

{
    "title": "Recurring Task Example xxx",
    "dueDateTime": {
        "dateTime": "2023-09-25T12:00:00.0000000",
        "timeZone": "UTC"
    },
    "recurrence": {
        "pattern": {
            "type": "weekly",
            "interval": 1
        },
        "range": {
            "type": "endDate",
            "startDate": "2023-09-25",
            "endDate": "2024-09-25"
        }
    }
}

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Sep 24, 2024
@chrismo
Copy link

chrismo commented Oct 15, 2024

Thx for posting this, I ran into this recently.

If you send an empty object {} in recurrence.range, the PATCH call succeeds. It'll rebuild the range object on the backend. I dunno if that's helpful for your use case or not. You can modify recurrence.pattern successfully, fwiw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants