Esempio n. 1
0
        public static async Task CreateTask(string AccessToken, string pageid, string taskcommand)
        {
            var    httpClient = new HttpClient();
            var    apiCaller  = new ProtectedApiCallHelper(httpClient);
            string data       = null;

            var           url = $"https://graph.microsoft.com/beta/me/onenote/pages/{pageid}/content";
            createcontent createcontentdetails = new createcontent();

            createcontentdetails.target  = "body";
            createcontentdetails.action  = "prepend";
            createcontentdetails.content = $"<p data-tag='to-do'>{taskcommand}</p>";

            data = "[" + JsonConvert.SerializeObject(createcontentdetails) + "]";


            JObject createtaskoutput = await apiCaller.CallPatchWebApiAndProcessResultASync(url, AccessToken, data);
        }
Esempio n. 2
0
        public static async Task <string> GetPageID(string AccessToken)
        {
            var httpClient = new HttpClient();
            var apiCaller  = new ProtectedApiCallHelper(httpClient);

            pagedetails pageDetails = new pagedetails();
            var         url         = $"https://graph.microsoft.com/beta/me/onenote/pages";

            JObject pdetails = await apiCaller.CallGetWebApiAndProcessResultASync(url, AccessToken);

            IList <JToken> pagedetailsresults = pdetails["value"].Children().ToList();

            IList <pagedetails> pagedetailssearchResults = new List <pagedetails>();

            foreach (JToken res in pagedetailsresults)
            {
                pageDetails = res.ToObject <pagedetails>();
                pagedetailssearchResults.Add(pageDetails);
            }

            return(pageDetails.id);
        }