public static async Task TrackRequestBody([TimerTrigger("0 */1 * * * *")] TimerInfo myTimer, ILogger log) { var accessToken = await GetAccessToken(); var client = HttpClientFactory.Create(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); var request = new TaggableItem { id = "0ff3ff8a-ff4a-45ef-9235-479409b5552e", tags = new List <string> { $"now-is-the-time|{DateTime.Now}" } }; var url = $"https://graph.microsoft.com/beta/applications/{request.id}"; var content = new ObjectContent <TaggableItem>(request, new JsonMediaTypeFormatter()); log.LogInformation($"Invoking {url} with body {await content.ReadAsStringAsync()}"); var result = await client.PatchAsync(url, content); result.EnsureSuccessStatusCode(); log.LogInformation($"Received response:\r\n {await result.Content.ReadAsStringAsync()} "); }
/// <summary> /// Deletes the tag. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void DeleteTag(object sender, EventArgs e) { var tag = sender as ImageButton; if (tag != null) { TaggableItem.RemoveTag(tag.CommandArgument); UpdateData(); } }
/// <summary> /// Creates the new tag. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void CreateNewTag(object sender, EventArgs e) { if (newTagTextBox.Text != "") { string[] tags = newTagTextBox.Text.Split(','); foreach (string s in tags) { if (s != "") { TaggableItem.AddTag(s.Trim()); } } UpdateData(); } }