microsoftgraph / microsoftgraph/msgraph-sdk-go

Cannot create private channel as part of a new team payload

Open
#715 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
335
Forks
43
Avg merge
15h 19m
Merged PRs (30d)
3

Description

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{}{
		"user@odata.bind": 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{}{
		"template@odata.bind": "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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Go example with Teams().Post using SDK v1.43.0, then inspect the returned team through Teams().ByTeamId(teamID).Channels().Get. Compare the serialized channel membershipType in the create request with the response and verify whether the Graph API preserves the private setting; done means the channel is visible and reports private, or the issue documents an API limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.