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

Planner support #22

Open
romanzenka opened this issue Mar 9, 2021 · 13 comments
Open

Planner support #22

romanzenka opened this issue Mar 9, 2021 · 13 comments
Labels
enhancement New feature or request

Comments

@romanzenka
Copy link
Contributor

Hello,

We would like to use programmatic access to the Microsoft Planner functionality so we can do some data science on tasks we are performing.

I will be trying to add planner support, I just wanted to know if you were planning this already (pun intended), would be interested in adding that functionality, or if it is out of scope forever.

@romanzenka
Copy link
Contributor Author

I am slowly brewing PR #23 if anyone wants to give me feedback. I might not have enough fuel to make this 100% polished and feature complete, but what I have has already allowed me to accomplish my task. Great work on this package!

@hongooi73
Copy link
Collaborator

I haven't got any definitive plans for feature additions, beyond Outlook; Planner can certainly be added to the list. Thanks for your great PR!

@hongooi73 hongooi73 added the enhancement New feature or request label Mar 9, 2021
@msberends
Copy link
Contributor

This is definitely something worthy to explore further! We use Microsoft Planner extensively at our organisation and our team uses RStudio Workbench. This would allow us to automate our workflows in RStudio with MS Planner!

Can you let me know what else would be needed for a full implementation? I can also collaborate - I'm a vivid R dev.

@msberends
Copy link
Contributor

Btw, the Outlook implementation and documentation are 😍😍

@hongooi73
Copy link
Collaborator

Thanks!

I think all that's needed is an easy way to modify plans and tasks. This shouldn't be too hard, as the underlying AzureGraph machinery already lets you call the REST API to do this. What's needed is to wrap these calls into R6 methods for the plan and task classes. Have a look at the ms_drive, ms_drive_item, ms_team and ms_channel classes if you want an idea of where to start.

@msberends
Copy link
Contributor

Great. I’ll read into it and start making some updates to the planner branch.

@hongooi73
Copy link
Collaborator

API documentation for tasks and plans: https://docs.microsoft.com/en-us/graph/api/resources/planner-overview?view=graph-rest-beta

@msberends
Copy link
Contributor

I can't get the initial implementation to work @romanzenka. There is an R6 definition of ms_plan now, but I don't think it follows the hierarchy defined in the REST API:

A plan can be owned by a group and contains a collection of plannerTasks. It can also have a collection of plannerBuckets. Each plan object has a details object which can contain more information about the plan. For more information about the relationships between groups, plans, and tasks, see Planner.
https://docs.microsoft.com/en-us/graph/api/resources/plannerplan?view=graph-rest-beta

Since users can have multiple plans, I think it should be implemented like this, analogous to the current get_outlook():

                get_planner()
             /       |          \
get_plan(...)   get_plan(...)    get_plan(...)
    |                |                |
create_task()       ...              ...
   ...              ...              ...
get_task()      get_task()       get_task()
    |                |                |
set_deadline()      ...              ...
add_checklist()     ...              ...
add_comment()       ...              ...
   ...

Not sure if the latter three lines are supported by the REST API.

Nonetheless, I think this should become possible:

# all tasks that authorised user is allowed to get:
get_planner()$get_tasks()

# only tasks within a certain plan (i.e., what Trello calls a 'board')
get_planner()$get_plan(...)$get_tasks()

# only tasks within a certain bucket (i.e., what Trello calls a 'list')
get_planner()$get_plan(...)$get_bucket()$get_tasks()

Last thing is, should there be a difference in get_personal_planner() and get_business_planner() just like other functions in the package?

Let me know if you agree with this concept. I'm not an admin of our organisation, so can't test everything I code.

@msberends
Copy link
Contributor

Ah, per https://docs.microsoft.com/en-us/graph/permissions-reference:

Access for Microsoft Planner tasks is controlled by Group permissions.

Group permissions are also used to control access to Microsoft Planner resources and APIs. Only delegated permissions are supported for Microsoft Planner APIs; application permissions are not supported. Personal Microsoft accounts are not supported.

Since all group permission require Admin Consent, that leaves me out for using and testing the Planner API 😞

@romanzenka
Copy link
Contributor Author

I am okay with complicating the API further if that is helpful. I go directly to the plan, skipping over the object that represents the planner itself. I have no use for the planner use-cases you describe (show every task a user owns for instance in any plan) and I do not really see the utility, however I can see why one would like to obtain a list of all plans.

As to the access rights - I have a group with planner that I control-ish, so that is how I tested the code. If Microsoft does not let you do something, there is little we can do in code...

@hongooi73
Copy link
Collaborator

hongooi73 commented Oct 8, 2021

As far as I know, all the tasks/plans calls are enabled by the Group.Readwrite.All permission, which is part of the default Microsoft365R app registration as well as all of the workarounds listed here. So if you're getting an error, you must be calling the API incorrectly.

Separating out get_business_planner and get_personal_planner would be good. They can call the same underlying REST endpoint (eg get_business_onedrive and get_personal_onedrive do the exact same thing but with different tenants) but it makes it easier for users with both personal and org accounts.

@hongooi73
Copy link
Collaborator

There is an R6 definition of ms_plan now, but I don't think it follows the hierarchy defined in the REST API:

The ms_plan R6 class corresponds to the plannerPlan Graph resource type. The ms_plan_task class corresponds to the plannerTask resource type. I don't see the problem here.

@elipousson
Copy link

If folks are curious, I'm working on an extension package for {Microsoft365R} for folks (like me) who are less familiar and comfortable with a workflow organized around S6 object methods.

I haven't implemented functions for buckets yet but I do have functions for plans: https://elipousson.github.io/sharepointr/reference/sp_plan.html

And for tasks: https://elipousson.github.io/sharepointr/reference/sp_tasks.html

For both functions, I implemented the as_data_frame parameter to return a data frame based on the properties of the returned ms_plan or ms_plan_task objects. Ideally, as_data_frame would be nice to see as a supported feature for the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants