Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Graph .NET
>
Tutorial
> Create channel
The following example shows a request to create a standard channel.
C# example
using System; using System.Threading.Tasks; using Independentsoft.Graph; using Independentsoft.Graph.Teams; namespace ConsoleApp1 { class Program { static async Task Main() { try { GraphClient client = new GraphClient(); client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.Username = "info@independentsoft.onmicrosoft.com"; client.Password = "password"; Channel channel = new Channel(); channel.DisplayName = "Discussion"; channel.Description = "This channel is where we debate all future plans"; Channel createdChannel = await client.CreateChannel("b030d33a-ffdc-4dae-80d7-123456", channel); Console.WriteLine("Id: " + createdChannel.Id); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); } } } }
VB example
Imports Independentsoft.Graph Imports Independentsoft.Graph.Teams Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Dim task = New Task(AddressOf Run) ' Start and wait for task to end. task.Start() Console.Read() End Sub Shared Async Sub Run() Try Dim client As GraphClient = New GraphClient() client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f" client.Tenant = "independentsoft.onmicrosoft.com" client.Username = "info@independentsoft.onmicrosoft.com" client.Password = "password" Dim channel As Channel = New Channel() channel.DisplayName = "Discussion" channel.Description = "This channel is where we debate all future plans" Dim createdChannel As Channel = Await client.CreateChannel("b030d33a-ffdc-4dae-80d7-123456", channel) Console.WriteLine("Id: " & createdChannel.Id) Catch ex As GraphException Console.WriteLine("Error: " + ex.Code) Console.WriteLine("Error: " + ex.Message) End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*