Exemplo n.º 1
0
        /// <summary>
        /// Add a task.
        /// </summary>
        /// <param name="listType">Task list type.</param>
        /// <param name="taskText">The task text.</param>
        /// <returns>Ture if succeed.</returns>
        public async Task <bool> AddTaskAsync(string listType, string taskText)
        {
            try
            {
                var pageContentUrl = await this.GetDefaultToDoPageAsync(listType);

                var todoContent = await ExecuteContentFetchAsync(pageContentUrl.ContentUrl + "/?includeIDs=true");

                var httpRequestMessage = ServiceHelper.GenerateAddToDoHttpRequest(taskText, todoContent, pageContentUrl.ContentUrl);
                var result             = await ExecuteSendAsync(httpRequestMessage);

                return(result);
            }
            catch (ServiceException ex)
            {
                throw ServiceHelper.HandleGraphAPIException(ex);
            }
        }