-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplyProBSettings.cs
66 lines (53 loc) · 2.65 KB
/
ApplyProBSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//using System;
//using System.Threading.Tasks;
//using Microsoft.AspNetCore.Mvc;
//using Microsoft.Azure.WebJobs;
//using Microsoft.Extensions.Configuration;
//using Microsoft.Extensions.Logging;
//using Microsoft.Graph;
//using Newtonsoft.Json;
//namespace appsvc_fnc_dev_scw_sensitivity_dotnet001
//{
// public class ApplyProBSettings
// {
// [FunctionName("ApplyProBSettings")]
// public async Task RunAsync([QueueTrigger("prob", Connection = "AzureWebJobsStorage")]string myQueueItem, ILogger log)
// {
// log.LogInformation($"ApplyProBSettings received a request: {myQueueItem}");
// dynamic data = JsonConvert.DeserializeObject(myQueueItem);
// IConfiguration config = new ConfigurationBuilder().AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).AddEnvironmentVariables().Build();
// string groupId = data?.groupId;
// string labelId = config["proBLabelId"];
// string DisplayName = data?.DisplayName;
// string requestId = data?.Id;
// string itemId = data?.itemId;
// ROPCConfidentialTokenCredential auth = new ROPCConfidentialTokenCredential(log);
// var graphClient = new GraphServiceClient(auth);
// var result = Common.ApplyLabel(graphClient, labelId, groupId, itemId, requestId, DisplayName, log);
// if (result.Result == true)
// {
// await SetProB(graphClient, groupId, log);
// await Common.RemoveOwner(graphClient, groupId, "e4b36075-bb6a-4acf-badb-076b0c3d8d90", log);
// await Common.AddToEmailQueue(requestId, groupId, DisplayName, (string)data?.RequesterName, (string)data?.RequesterEmail, log);
// }
// log.LogInformation($"ApplyProBSettings processed a request.");
// }
// private static async Task<IActionResult> SetProB(GraphServiceClient graphClient, string groupId, ILogger log)
// {
// log.LogInformation("SetProB received a request.");
// try
// {
// var group = new Microsoft.Graph.Group { Visibility = "Private" };
// await graphClient.Groups[groupId].Request().UpdateAsync(group);
// }
// catch (Exception e)
// {
// log.LogError($"Message: {e.Message}");
// if (e.InnerException is not null) log.LogError($"InnerException: {e.InnerException.Message}");
// log.LogError($"StackTrace: {e.StackTrace}");
// }
// log.LogInformation("SetProB processed a request.");
// return new OkResult();
// }
// }
//}