Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create private channel as part of a new team payload #715

Open
sarjumulmi opened this issue May 24, 2024 · 1 comment
Open

Cannot create private channel as part of a new team payload #715

sarjumulmi opened this issue May 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sarjumulmi
Copy link

sarjumulmi commented May 24, 2024

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

@rkodev
Copy link
Contributor

rkodev commented May 30, 2024

Related to microsoftgraph/msgraph-sdk-dotnet#1968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants