//gavdcodeend 04 //gavdcodebegin 05 static void CreateChannelApp() { string graphQuery = "https://graph.microsoft.com/v1.0/teams/" + "5b409eec-a4ae-4f04-a354-0434c444265d/channels"; string myBody = "{ " + "\"displayName\": \"Graph Channel 01 Application\"," + "\"description\": \"Channel created with Graph\"" + " }"; RestGraphClient myClient = new RestGraphClient { ClientID = ConfigurationManager.AppSettings["ClientIdApp"], ClientSecret = ConfigurationManager.AppSettings["ClientSecretApp"], TenantName = ConfigurationManager.AppSettings["TenantName"], EndPoint = graphQuery, Method = HttpVerb.POST, ContentType = "application/json", PostData = myBody, Registration = TypeRegistration.Application }; Tuple <string, string> resultText = myClient.SendGraphRequest(); Console.WriteLine(resultText.Item1); Console.WriteLine(resultText.Item2); }
//gavdcodebegin 07 static void UpdateChannelApp() { string graphQuery = "https://graph.microsoft.com/v1.0/teams/" + "5b409eec-a4ae-4f04-a354-0434c444265d/channels/" + "19:[email protected]"; string myBody = "{ \"description\": \"Channel Description Updated\" }"; List <HeaderConfig> myHeadersList = new List <HeaderConfig>(); HeaderConfig myHeaderMat = new HeaderConfig { HeaderTitle = "IF-MATCH", HeaderValue = "*" }; myHeadersList.Add(myHeaderMat); RestGraphClient myClient = new RestGraphClient { ClientID = ConfigurationManager.AppSettings["ClientIdApp"], ClientSecret = ConfigurationManager.AppSettings["ClientSecretApp"], TenantName = ConfigurationManager.AppSettings["TenantName"], EndPoint = graphQuery, Method = HttpVerb.PATCH, ContentType = "application/json", Headers = myHeadersList, PostData = myBody, Registration = TypeRegistration.Application }; Tuple <string, string> resultText = myClient.SendGraphRequest(); Console.WriteLine(resultText.Item1); Console.WriteLine(resultText.Item2); }
//gavdcodebegin 03 static void GetTeamApp() { string graphQuery = "https://graph.microsoft.com/v1.0/teams/5b409eec-a4ae-4f04-a354-0434c444265d"; RestGraphClient myClient = new RestGraphClient { ClientID = ConfigurationManager.AppSettings["ClientIdApp"], ClientSecret = ConfigurationManager.AppSettings["ClientSecretApp"], TenantName = ConfigurationManager.AppSettings["TenantName"], EndPoint = graphQuery, Method = HttpVerb.GET, Registration = TypeRegistration.Application }; Tuple <string, string> resultText = myClient.SendGraphRequest(); Console.WriteLine(resultText.Item1); Console.WriteLine(resultText.Item2); }
//gavdcodeend 08 //gavdcodebegin 09 static void DeleteChannelApp() { string graphQuery = "https://graph.microsoft.com/v1.0/teams/" + "5b409eec-a4ae-4f04-a354-0434c444265d/channels/" + "19:[email protected]"; RestGraphClient myClient = new RestGraphClient { ClientID = ConfigurationManager.AppSettings["ClientIdApp"], ClientSecret = ConfigurationManager.AppSettings["ClientSecretApp"], TenantName = ConfigurationManager.AppSettings["TenantName"], EndPoint = graphQuery, Method = HttpVerb.DELETE, Registration = TypeRegistration.Application }; Tuple <string, string> resultText = myClient.SendGraphRequest(); Console.WriteLine(resultText.Item1); Console.WriteLine(resultText.Item2); }
//gavdcodeend 09 //gavdcodebegin 10 static void DeleteChannelDel() { string graphQuery = "https://graph.microsoft.com/v1.0/teams/" + "5b409eec-a4ae-4f04-a354-0434c444265d/channels/" + "19:[email protected]"; RestGraphClient myClient = new RestGraphClient { ClientID = ConfigurationManager.AppSettings["ClientIdDel"], TenantName = ConfigurationManager.AppSettings["TenantName"], UserName = ConfigurationManager.AppSettings["UserName"], UserPw = ConfigurationManager.AppSettings["UserPw"], EndPoint = graphQuery, Method = HttpVerb.DELETE, Registration = TypeRegistration.Delegation }; Tuple <string, string> resultText = myClient.SendGraphRequest(); Console.WriteLine(resultText.Item1); Console.WriteLine(resultText.Item2); }