Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Graph JS
>
Tutorial
> Create team
The following example shows you how to create a team.
import { GraphClient } from '../independentsoft/graph/graph.js'; import { Team, TeamMemberSettings, TeamFunSettings, AadUserConversationMember} from '../independentsoft/graph/teams.js'; async function mainFunc() { try { const client = new GraphClient(); client.clientId = "xxxxxxxxxx-209e-454e-xxxxxxxxxxxxxxxxxxx"; client.tenant = "independentsoft.onmicrosoft.com"; client.clientSecret = "xxxxxxxxx.ONVE[=zYYxxxxxxxxxxxxxxxx"; const user1 = await client.getUser("info@independentsoft.onmicrosoft.com"); let member1 = new AadUserConversationMember(); member1.userId = user1.id; member1.roles.push("owner"); let team1 = new Team(); team1.displayName = "Team1"; team1.description = "Team1"; team1.members.push(member1); team1.memberSettings = new TeamMemberSettings(); team1.memberSettings.allowAddRemoveApps = true; team1.memberSettings.allowCreatePrivateChannels = true; team1.memberSettings.allowCreateUpdateRemoveConnectors = true; team1.funSettings = new TeamFunSettings(); team1.funSettings.allowCustomMemes = true; const teamId = await client.createTeam(team1); console.log("Id = " + teamId); } catch (e) { console.error(e.code) //error code console.error(e.message) //description console.error(e.date) //timestamp console.error(e.innerError) //innerError } } mainFunc();
Need help? Ask our developers:
Name*
Email*
Message*