Skip to content

Allow updating To Do task importance and checklist names - #1224

Open
snfx-johaver wants to merge 2 commits into
O365:masterfrom
snfx-johaver:snfx-johaver-to-do-sdk-setters
Open

snfx-johaver wants to merge 2 commits into
O365:masterfrom
snfx-johaver:snfx-johaver-to-do-sdk-setters

Conversation

@snfx-johaver

@snfx-johaver snfx-johaver commented Nov 11, 2026 •

Copy link
Copy Markdown

I'd like to add two writable properties to the To Do SDK:

task.importance = 'low'  # 'low', 'normal', or 'high'; also accepts ImportanceLevel members
task.save()

checklist_item.displayname = 'Review the contract'
checklist_item.save()

Both use the existing change tracking. The importance setter uses the shared ImportanceLevel enum and its string conversion, while keeping the existing string getter compatible. Invalid values raise ValueError, and unrelated saves don't send or reset importance. Renaming a checklist item doesn't change its checked state.

I've added usage examples and 34 passing request-level regression tests covering string and enum inputs, creates, updates, validation, combined edits, preservation, and retry after a failed save. Run with PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests/test_tasks.py -q (plugin autoload is disabled to avoid an unrelated locally installed Home Assistant plugin).

This unblocks RogerSelwyn/MS365-ToDo#199 once these SDK changes are merged and released. I haven't changed the package version or assumed a release number.

Track task importance and checklist display name updates through save(). Preserve omitted importance and unrelated fields, with request-level regression tests and usage examples.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread O365/tasks.py
return self.__importance

@importance.setter
def importance(self, value):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be using an eNum for enforcing the value, there is an example in Calendar Event.

from .utils import ImportanceLevel

    @importance.setter
    def importance(self, value):
        self.__importance = (value if isinstance(value, ImportanceLevel)
                             else ImportanceLevel.from_value(value))
        self._track_changes.add(self._cc('importance'))

Imo

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Roger — updated to use the shared ImportanceLevel enum and its string conversion. It now accepts enum members too, while keeping the existing string getter compatible. Invalid values still raise ValueError. All 34 tests pass, including string and enum inputs for each importance level.

Auto-replied by the GitHub Copilot app

Accept enum members and shared string conversion while preserving the existing string getter and explicit invalid-value errors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants