|
16 | 16 | #' - `sync_fields()`: Synchronise the R object with the team metadata in Microsoft Graph. |
17 | 17 | #' - `list_channels(filter=NULL, n=Inf)`: List the channels for this team. |
18 | 18 | #' - `get_channel(channel_name, channel_id)`: Retrieve a channel. If the name and ID are not specified, returns the primary channel. |
19 | | -#' - `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). |
| 19 | +#' - `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. |
20 | 20 | #' - `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. |
21 | 21 | #' - `list_drives(filter=NULL, n=Inf)`: List the drives (shared document libraries) associated with this team. |
22 | 22 | #' - `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. |
|
57 | 57 | #' } |
58 | 58 | #' @format An R6 object of class `ms_team`, inheriting from `ms_object`. |
59 | 59 | #' @export |
60 | | -ms_team <- R6::R6Class("ms_team", inherit=ms_object, |
| 60 | +ms_team <- R6::R6Class("ms_team", inherit=ms_teams_object, |
61 | 61 |
|
62 | 62 | public=list( |
63 | 63 |
|
@@ -88,18 +88,25 @@ public=list( |
88 | 88 | else if(is.null(channel_name) && !is.null(channel_id)) |
89 | 89 | file.path("channels", channel_id) |
90 | 90 | else stop("Do not supply both the channel name and ID", call.=FALSE) |
| 91 | + |
91 | 92 | ms_channel$new(self$token, self$tenant, self$do_operation(op), team_id=self$properties$id) |
92 | 93 | }, |
93 | 94 |
|
94 | | - create_channel=function(channel_name, description="", membership=c("standard", "private")) |
| 95 | + create_channel=function(channel_name, description="", membership=c("standard", "private", "shared")) |
95 | 96 | { |
96 | 97 | membership <- match.arg(membership) |
97 | 98 | body <- list( |
98 | 99 | displayName=channel_name, |
99 | 100 | description=description, |
100 | 101 | membershipType=membership |
101 | 102 | ) |
102 | | - ms_channel$new(self$token, self$tenant, self$do_operation("channels", body=body, http_verb="POST"), |
| 103 | + obj <- self$do_operation("channels", body=body, http_verb="POST") |
| 104 | + if(membership == "shared") |
| 105 | + { |
| 106 | + cat("Shared channel creation started in the background. Use the 'get_channel' method to retrieve it.\n") |
| 107 | + return(NULL) |
| 108 | + } |
| 109 | + ms_channel$new(self$token, self$tenant, , |
103 | 110 | team_id=self$properties$id) |
104 | 111 | }, |
105 | 112 |
|
|
0 commit comments