Skip to content

Commit

Permalink
Try catch all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
FlangvikOld committed Apr 13, 2023
1 parent a6ee44c commit 1190051
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions TeamFiltration/TeamFiltration/Handlers/TeamsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,23 @@ public async Task<WorkingWithResp> 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<List<GetPresenceResp>>(await getUserPresence.Content.ReadAsStringAsync());
new StringContent(
"[{ \"mri\":\"" + responeObject.FirstOrDefault().mri + "\"}]"
, Encoding.UTF8
, "application/json"
)
);


var getPresenceObject = JsonConvert.DeserializeObject<List<GetPresenceResp>>(await getUserPresence.Content.ReadAsStringAsync());

try
{
if (getPresenceObject.FirstOrDefault()?.presence?.calendarData?.isOutOfOffice != null)
{
Outofofficenote = getPresenceObject.FirstOrDefault()?.presence?.calendarData.outOfOfficeNote;
Expand All @@ -223,7 +225,7 @@ public async Task<WorkingWithResp> GetWorkingWithList(string tenantId)
catch (Exception ex)
{


}

return (true, responeObject.FirstOrDefault().objectId, responeObject.FirstOrDefault(), Outofofficenote);
Expand Down

0 comments on commit 1190051

Please sign in to comment.