Example #1
0
        private async Task <string> CreateOneNoteSection(string sectionContentUrl, string sectionTitle)
        {
            var makeSectionContent = await this.httpClient.GetStringAsync(sectionContentUrl);

            var httpRequestMessage = ServiceHelper.GenerateCreateSectionHttpRequest(makeSectionContent, sectionContentUrl, sectionTitle);
            var result             = await this.httpClient.SendAsync(httpRequestMessage);

            dynamic responseContent = JObject.Parse(await result.Content.ReadAsStringAsync());

            return((string)responseContent.id);
        }
Example #2
0
        private async Task <string> CreateOneNoteSectionAsync(string sectionContentUrl, string sectionTitle)
        {
            var makeSectionContent = await ExecuteContentFetchAsync(sectionContentUrl);

            var httpRequestMessage = ServiceHelper.GenerateCreateSectionHttpRequest(makeSectionContent, sectionContentUrl, sectionTitle);
            var result             = await httpClient.SendAsync(httpRequestMessage);

            dynamic responseContent = JObject.Parse(await result.Content.ReadAsStringAsync());

            if (result.IsSuccessStatusCode)
            {
                return((string)responseContent.id);
            }
            else
            {
                ServiceException serviceException = ServiceHelper.GenerateServiceException(responseContent);
                throw serviceException;
            }
        }