Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion R/ms_channel.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#' }
#' @format An R6 object of class `ms_channel`, inheriting from `ms_object`.
#' @export
ms_channel <- R6::R6Class("ms_channel", inherit=ms_object,
ms_channel <- R6::R6Class("ms_channel", inherit=ms_teams_object,

public=list(

Expand Down
2 changes: 1 addition & 1 deletion R/ms_chat.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#' }
#' @format An R6 object of class `ms_chat`, inheriting from `ms_object`.
#' @export
ms_chat <- R6::R6Class("ms_chat", inherit=ms_object,
ms_chat <- R6::R6Class("ms_chat", inherit=ms_teams_object,

public=list(

Expand Down
2 changes: 1 addition & 1 deletion R/ms_chat_message.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#' }
#' @format An R6 object of class `ms_chat_message`, inheriting from `ms_object`.
#' @export
ms_chat_message <- R6::R6Class("ms_chat_message", inherit=ms_object,
ms_chat_message <- R6::R6Class("ms_chat_message", inherit=ms_teams_object,

public=list(

Expand Down
15 changes: 11 additions & 4 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). Note that creating a shared channel is an _asynchronous_ operation; the call returns before the creation is finished. You can retrieve the channel with the `get_channel` method after waiting for a short while.
#' - `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 @@ -57,7 +57,7 @@
#' }
#' @format An R6 object of class `ms_team`, inheriting from `ms_object`.
#' @export
ms_team <- R6::R6Class("ms_team", inherit=ms_object,
ms_team <- R6::R6Class("ms_team", inherit=ms_teams_object,

public=list(

Expand Down Expand Up @@ -88,18 +88,25 @@ 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)
},

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(
displayName=channel_name,
description=description,
membershipType=membership
)
ms_channel$new(self$token, self$tenant, self$do_operation("channels", body=body, http_verb="POST"),
obj <- self$do_operation("channels", body=body, http_verb="POST")
if(membership == "shared")
{
cat("Shared channel creation started in the background. Use the 'get_channel' method to retrieve it.\n")
return(NULL)
}
ms_channel$new(self$token, self$tenant, ,
team_id=self$properties$id)
},

Expand Down
2 changes: 1 addition & 1 deletion R/ms_team_member.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' [Microsoft Teams API reference](https://learn.microsoft.com/en-us/graph/api/resources/teams-api-overview?view=graph-rest-1.0)
#' @format An R6 object of class `ms_team_member`, inheriting from `ms_object`.
#' @export
ms_team_member <- R6::R6Class("ms_team_member", inherit=ms_object,
ms_team_member <- R6::R6Class("ms_team_member", inherit=ms_teams_object,

public=list(

Expand Down
11 changes: 11 additions & 0 deletions R/ms_teams_object.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Prefer header needed to work with shared channels
ms_teams_object <- R6::R6Class("ms_teams_object", inherit=ms_object,

public=list(

do_operation=function(op="", ...)
{
outlook_headers <- httr::add_headers(Prefer="include-unknown-enum-members")
super$do_operation(op, ..., outlook_headers)
}
))
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.