msgraph-sdk-go
msgraph-sdk-go copied to clipboard
Cannot create private channel as part of a new team payload
trafficstars
When I try to create a new team along with a new private channel, the channel is hidden & set to a standard membership type.
reqBody := graphmodels.NewTeam()
displayName := "My Test Team"
description := "My very first test team"
reqBody.SetDisplayName(&displayName)
reqBody.SetDescription(&description)
conversationMember := graphmodels.NewAadUserConversationMember()
roles := []string{
"owner",
}
conversationMember.SetRoles(roles)
memberAdditionalData := map[string]interface{}{
"[email protected]": fmt.Sprintf("https://graph.microsoft.com/v1.0/users('%s')", ownerID),
}
conversationMember.SetAdditionalData(memberAdditionalData)
members := []graphmodels.ConversationMemberable{
conversationMember,
}
reqBody.SetMembers(members)
channel := graphmodels.NewChannel()
channelDisplayName := "test pvt channel"
channelDescription := "test pvt channel for test team"
membershipType := graphmodels.PRIVATE_CHANNELMEMBERSHIPTYPE //setting membership type to private
channel.SetDisplayName(&channelDisplayName)
channel.SetDescription(&channelDescription)
channel.SetMembershipType(&membershipType)
channel.SetMembers(members)
channels := []graphmodels.Channelable{channel}
reqBody.SetChannels(channels)
templAdditionalData := map[string]interface{}{
"[email protected]": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
}
reqBody.SetAdditionalData(templAdditionalData)
team, err := gc.Teams().Post(ctx, reqBody, nil)
if err != nil {
log.Panicf("error creating team: %v", err)
return
}
When I query for the channels in the new team created, it comes back as standard. I can see the new channel under Hidden Channels in the UI & it's set to a standard channel.
channelsResp, err := gc.Teams().ByTeamId(teamID).Channels().Get(ctx, nil)
if err != nil {
log.Panicf("error creating channels: %v", err)
return
}
for _, ch := range channelsResp.GetValue() {
log.Printf("channel: %s: %s\n", *ch.GetDisplayName(), ch.GetMembershipType())
}
// logs:
// channel: General: standard
// channel: test pvt channel: standard
Expected Behavior:
Channel is shown & membership type is set to private
SDK version:
v1.43.0
Related to https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1968