Microsoft365R icon indicating copy to clipboard operation
Microsoft365R copied to clipboard

How do I create shared teams folder?

Open mladencucak opened this issue 1 year ago • 14 comments

How to pass ah argument to: team$create_channel(teams_channel ) to make it a shared folder?

mladencucak avatar Jul 06 '23 20:07 mladencucak

Hi @hongooi73

Would shared channels ever be an option for the create_channel method?

I can see in the docs that there is membership option to switch between standard or private but no info on shared ones. Thanks!

RPanczak avatar Nov 27 '23 07:11 RPanczak

The teams-shared-channels branch now lets you set membership="shared" to create a shared channel, let me know if it works.

hongooi73 avatar Feb 15 '24 12:02 hongooi73

Many thanks for working on that @hongooi73

Tested with

# needs specific branch!
# remotes::install_github("Azure/Microsoft365R@teams-shared-channels")

library(Microsoft365R)

team <- Microsoft365R::get_team(team_name = "Your team name here")

team$list_channels()

team$create_channel("test_shared", membership = "shared")

Channel has been created and is correctly set to shared type. However I also get an error:

Error in self$properties$displayName : 
  $ operator is invalid for atomic vectors

RPanczak avatar Feb 21 '24 08:02 RPanczak

I've pushed a fix. Can you try it now?

In general, debugging business-related features is hard for me since I don't have a work/school MS365 account. I'd be grateful for any help in this regard.

hongooi73 avatar Feb 22 '24 04:02 hongooi73

Thank you for the fix - all stayed the same so the channel gets created correctly and the same error message appears

RPanczak avatar Feb 22 '24 09:02 RPanczak

Trying to narrow it down here; does z <- team$create_channel("xyz", membership="shared") work? Ie, creating the channel but NOT printing it to the screen.

hongooi73 avatar Feb 22 '24 10:02 hongooi73

Yes! That creates channel correctly without error 💪

RPanczak avatar Feb 22 '24 10:02 RPanczak

Great! Can you tell me what z$properties is?

hongooi73 avatar Feb 22 '24 11:02 hongooi73

Sure thing - this is what i get:

raw(0)
attr(,"status")
[1] 202

RPanczak avatar Feb 22 '24 14:02 RPanczak

Ok, that means it was created properly, but the create op isn't returning the properties for the channel, like it should.

Just to confirm, you did install the latest commit from the team-shared-channel branch, yes? As of ~10-11 hours ago?

hongooi73 avatar Feb 22 '24 15:02 hongooi73

Ok, it's more complicated than I thought....

If successful, this method returns a 201 Created response code and a channel object in the response body for a channel with a membershipType value of standard or private. For a channel with a membershipType value of shared, this method returns a 202 Accepted response code and a link to the teamsAsyncOperation.

So basically, the code succeeds in creating the channel, it just isn't waiting like it should to confirm the result.

hongooi73 avatar Feb 22 '24 15:02 hongooi73

I've pushed a small change that will alert you when you're creating a shared channel. To retrieve it, wait a while and then use get_channel. This is simpler than waiting for the async operation to complete (which would in any case negate the point of it being asynchronous).

hongooi73 avatar Feb 22 '24 15:02 hongooi73

Thanks for sorting this out, I already gave up on this :) !

mladencucakSYN avatar Feb 24 '24 19:02 mladencucakSYN

Hi @hongooi73 Do you have any (even approximate) plan or timeline on when these changes could make it to main?

RPanczak avatar Mar 26 '24 07:03 RPanczak