Skip to content

Commit

Permalink
shared channel support
Browse files Browse the repository at this point in the history
  • Loading branch information
hongooi73 committed Feb 15, 2024
1 parent 569dab1 commit b616172
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- In the `ms_drive_item$load_dataframe()` method, pass the `...` argument to `read_delim`.
- Add the ability to load Excel files (with extension .xls or .xlsx) to the `ms_drive_item$load_dataframe()` method. This requires the readxl package to be installed.

## Teams

- Add the ability to create shared channels (#174).

## Planner

- Fix a bug in the `ms_plan$get_details()` method.
Expand Down
9 changes: 6 additions & 3 deletions R/ms_team.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' - `sync_fields()`: Synchronise the R object with the team metadata in Microsoft Graph.
#' - `list_channels(filter=NULL, n=Inf)`: List the channels for this team.
#' - `get_channel(channel_name, channel_id)`: Retrieve a channel. If the name and ID are not specified, returns the primary channel.
#' - `create_channel(channel_name, description, membership)`: Create a new channel. Optionally, you can specify a short text description of the channel, and the type of membership: either standard or private (invitation-only).
#' - `create_channel(channel_name, description, membership)`: Create a new channel. Optionally, you can specify a short text description of the channel, and the type of membership: either standard, shared or private (invitation-only).
#' - `delete_channel(channel_name, channel_id, confirm=TRUE)`: Delete a channel; by default, ask for confirmation first. You cannot delete the primary channel of a team. Note that Teams keeps track of all channels ever created, even if you delete them (you can see the deleted channels by going to the "Manage team" pane for a team, then the "Channels" tab, and expanding the "Deleted" entry); therefore, try not to create and delete channels unnecessarily.
#' - `list_drives(filter=NULL, n=Inf)`: List the drives (shared document libraries) associated with this team.
#' - `get_drive(drive_name, drive_id)`: Retrieve a shared document library for this team. If the name and ID are not specified, this returns the default document library.
Expand Down Expand Up @@ -88,10 +88,13 @@ public=list(
else if(is.null(channel_name) && !is.null(channel_id))
file.path("channels", channel_id)
else stop("Do not supply both the channel name and ID", call.=FALSE)
ms_channel$new(self$token, self$tenant, self$do_operation(op), team_id=self$properties$id)

# Prefer header needed to get shared channels
obj <- self$do_operation(op, httr::add_headers(Prefer="include-unknown-enum-members"))
ms_channel$new(self$token, self$tenant, obj, team_id=self$properties$id)
},

create_channel=function(channel_name, description="", membership=c("standard", "private"))
create_channel=function(channel_name, description="", membership=c("standard", "private", "shared"))
{
membership <- match.arg(membership)
body <- list(
Expand Down
2 changes: 1 addition & 1 deletion man/ms_team.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b616172

Please sign in to comment.