Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addition of two new actions in o365 #9106

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "Request",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "Response"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using namespace System.Net

# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$flag = 0
# Write to the Azure Functions log stream.
Write-Host "Fetching list of Malware policies"

$Mailbox = $Request.Body.Mailbox
# Interact with query parameters or the body of the request.

try{
if($Mailbox)
{
$Result = Get-InboxRule -Mailbox "$Mailbox"
if($?){Write-Host "Successfully fetched list of Inbox Rules"
$flag = 1
}
else
{Write-Host "Failed to fetch list of Inbox Rules"}

}else
{Write-Host "Mailbox not provided : Failed to fetch list of Inbox Rules"}
}

catch{
Write-Host "$_.Exception"
$Result = "$_.Exception"
}

finally{
if($flag){
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $Result
})}else{

Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::NotFound
Body = $Result
})
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "Request",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "Response"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using namespace System.Net

# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$flag = 0
# Write to the Azure Functions log stream.
Write-Host "Proceeding with delete of Inbox Rule"

$Mailbox = $Request.Body.Mailbox
$Identity = $Request.Body.Identity
# Interact with query parameters or the body of the request.

try{
if($Mailbox -AND $Identity)
{
$Result = Remove-InboxRule -Mailbox "$Mailbox" -Identity "$Identity" -Confirm:$false
if($?){Write-Host "Successfully Deleted the rule"
$flag = 1
}
else
{Write-Host "Failed to delete Inbox Rules"}

}else
{Write-Host "Mailbox or Identity not provided : Failed to delete Inbox Rules"}
}

catch{
Write-Host "$_.Exception"
$Result = "$_.Exception"
}

finally{
if($flag){
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $Result
})}else{

Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::NotFound
Body = $Result
})
}
}