Independentsoft
Home
Purchase
Support
Company
Contact
Graph .NET
>
Tutorial
> Update TodoTask list
The following example shows you how to update a TodoTask list.
C# example
using System; using System.Collections.Generic; using System.Threading.Tasks; using Independentsoft.Graph; using Independentsoft.Graph.Todo; namespace Sample { class Program { static async Task Main(string[] args) { try { GraphClient client = new GraphClient(); client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; IList<TodoTaskList> todoTaskLists = await client.GetTodoTaskLists(); for (int i = 0; i < todoTaskLists.Count; i++) { if (todoTaskLists[i].DisplayName == "My Task List") { TodoTaskList updateList = new TodoTaskList(); updateList.Id = todoTaskLists[i].Id; updateList.DisplayName = "Updated Task List"; await client.UpdateTodoTaskList(updateList); Console.WriteLine("TodoTask list updated."); } } Console.Read(); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); Console.Read(); } } } }
VB example
Imports System.Collections.Generic Imports Independentsoft.Graph Imports Independentsoft.Graph.Todo Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Dim task = New Task(AddressOf Run) 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.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Dim todoTaskLists As IList(Of TodoTaskList) = Await client.GetTodoTaskLists() For i As Integer = 0 To todoTaskLists.Count - 1 If todoTaskLists(i).DisplayName = "My Task List" Then Dim updateList As TodoTaskList = New TodoTaskList() updateList.Id = todoTaskLists(i).Id updateList.DisplayName = "Updated Task List" Await client.UpdateTodoTaskList(updateList) Console.WriteLine("TodoTask list updated.") End If Next Catch ex As GraphException Console.WriteLine("Error: " + ex.Code) Console.WriteLine("Error: " + ex.Message) Console.Read() End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*