From 119005109b2836ca4806f5163432c598852671bb Mon Sep 17 00:00:00 2001 From: Melvin Langvik Date: Thu, 13 Apr 2023 15:51:04 +0200 Subject: [PATCH] Try catch all the things --- .../TeamFiltration/Handlers/TeamsHandler.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/TeamFiltration/TeamFiltration/Handlers/TeamsHandler.cs b/TeamFiltration/TeamFiltration/Handlers/TeamsHandler.cs index 969d71f..f79e762 100644 --- a/TeamFiltration/TeamFiltration/Handlers/TeamsHandler.cs +++ b/TeamFiltration/TeamFiltration/Handlers/TeamsHandler.cs @@ -200,21 +200,23 @@ public async Task GetWorkingWithList(string tenantId) ) { - //Check the user presence - HttpResponseMessage getUserPresence = await _teamsClient.PollyPostAsync( - $"https://presence.teams.microsoft.com/v1/presence/getpresence/", + try + { - new StringContent( - "[{ \"mri\":\"" + responeObject.FirstOrDefault().mri + "\"}]" - , Encoding.UTF8 - , "application/json" - ) - ); + //Check the user presence + HttpResponseMessage getUserPresence = await _teamsClient.PollyPostAsync( + $"https://presence.teams.microsoft.com/v1/presence/getpresence/", - var getPresenceObject = JsonConvert.DeserializeObject>(await getUserPresence.Content.ReadAsStringAsync()); + new StringContent( + "[{ \"mri\":\"" + responeObject.FirstOrDefault().mri + "\"}]" + , Encoding.UTF8 + , "application/json" + ) + ); + + + var getPresenceObject = JsonConvert.DeserializeObject>(await getUserPresence.Content.ReadAsStringAsync()); - try - { if (getPresenceObject.FirstOrDefault()?.presence?.calendarData?.isOutOfOffice != null) { Outofofficenote = getPresenceObject.FirstOrDefault()?.presence?.calendarData.outOfOfficeNote; @@ -223,7 +225,7 @@ public async Task GetWorkingWithList(string tenantId) catch (Exception ex) { - + } return (true, responeObject.FirstOrDefault().objectId, responeObject.FirstOrDefault(), Outofofficenote);