public async System.Threading.Tasks.Task <FileResult> DownloadDetectionScript(string Id) { GraphIntune graphIntune = new GraphIntune(null); Win32LobApp win32LobApp = await graphIntune.GetWin32MobileAppAsync(Id); Win32LobAppPowerShellScriptDetection script = await graphIntune.GetWin32MobileAppPowerShellDetectionRuleAsync(Id); string fileName = $"{FilenameHelper.ProcessFileName(win32LobApp.DisplayName)}_detect.ps1"; return(File(Convert.FromBase64String(script.ScriptContent), "text/plain", fileName)); }
public async Task <ActionResult> Win32AppPsDetectionScriptContent(string Id) { try { GraphIntune graphIntune = new GraphIntune(null); var script = await graphIntune.GetWin32MobileAppPowerShellDetectionRuleAsync(Id); string powerShellCode = Encoding.UTF8.GetString(Convert.FromBase64String(script.ScriptContent)); return(PartialView("_PowerShellDetectionScriptContent", powerShellCode)); } catch (ServiceException e) { Flash(e.Error.Message); return(RedirectToAction("Index", "Home")); } }
public async System.Threading.Tasks.Task <PartialViewResult> Win32AppPsDetectionScriptContent(string Id) { try { GraphIntune graphIntune = new GraphIntune(null); var script = await graphIntune.GetWin32MobileAppPowerShellDetectionRuleAsync(Id); string powerShellCode = Encoding.UTF8.GetString(Convert.FromBase64String(script.ScriptContent)); return(PartialView("_PowerShellDetectionScriptContent", powerShellCode)); } catch (Exception e) { Flash("Error getting DeviceManagementScripts" + e.Message.ToString()); return(PartialView()); } }
public async Task <ActionResult> DownloadDetectionScript(string Id) { try { GraphIntune graphIntune = new GraphIntune(null); Win32LobApp win32LobApp = await graphIntune.GetWin32MobileAppAsync(Id); Win32LobAppPowerShellScriptDetection script = await graphIntune.GetWin32MobileAppPowerShellDetectionRuleAsync(Id); string fileName = $"{FilenameHelper.ProcessFileName(win32LobApp.DisplayName)}_detect.ps1"; return(File(Convert.FromBase64String(script.ScriptContent), "text/plain", fileName)); } catch (ServiceException e) { Flash(e.Error.Message); return(RedirectToAction("Index", "Home")); } }