microsoftgraph / microsoftgraph/msgraph-sdk-go
Unable to get ID of a newly created Teams team
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 335
- Forks
- 43
- Avg merge
- 15h 19m
- Merged PRs (30d)
- 3
Description
I'm following the documentation to create a team in Teams by using the following code:
newTeam := graphmodels.NewTeam()
displayName := "Test team"
newTeam.SetDisplayName(&displayName)
newTeam.SetAdditionalData(map[string]interface{}{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
})
// Set the owner of the team
conversationMember := graphmodels.NewAadUserConversationMember()
roles := []string{"owner"}
conversationMember.SetRoles(roles)
conversationMember.SetAdditionalData(map[string]interface{}{
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')",
})
membersToAdd := []graphmodels.ConversationMemberable{
conversationMember,
}
newTeam.SetMembers(membersToAdd)
teams, err := client.Teams().Post(context.Background(), newTeam, nil)
if err != nil {
fmt.Println(err)
}
fmt.Println(teams.GetId())
In the TAC I can see that the team was created successfully, but when trying to get the ID of the newly created team at the end (for further processing) I receive an invalid memory address or nil pointer dereference.
Based on the documentation I would assume that's due to the expected HTTP 202 received from the POST and that the creation of the team takes a little bit in the background. Am I missing something? I wasn't able to find something related in the documentation pointing me to a solution.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Teams().Post call and the Microsoft Graph team-creation documentation linked in the issue. Reproduce the request using the supplied graphmodels setup, then inspect the returned teams value and HTTP response behavior around the asynchronous 202 result. Done means the response can be handled without a nil-pointer dereference and the newly created team's ID retrieval behavior is clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100