File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 1+ using namespace System.Net
2+
3+ function Invoke-ExecSetPackageTag {
4+ <#
5+ . FUNCTIONALITY
6+ Entrypoint,AnyTenant
7+ . ROLE
8+ CIPP.Core.ReadWrite
9+ #>
10+ [CmdletBinding ()]
11+ param ($Request , $TriggerMetadata )
12+
13+ $APIName = $Request.Params.CIPPEndpoint
14+ $Headers = $Request.Headers
15+ Write-LogMessage - headers $Headers - API $APIName - message ' Accessed this API' - Sev ' Debug'
16+ $Table = Get-CippTable - tablename ' templates'
17+
18+ try {
19+ $GUIDS = $Request.body.GUID
20+ $PackageName = $Request.body.Package | Select-Object - First 1
21+ foreach ($GUID in $GUIDS ) {
22+ $Filter = " RowKey eq '$GUID '"
23+ $Template = Get-CIPPAzDataTableEntity @Table - Filter $Filter
24+ Add-CIPPAzDataTableEntity @Table - Entity @ {
25+ JSON = $Template.JSON
26+ RowKey = " $GUID "
27+ PartitionKey = $Template.PartitionKey
28+ GUID = " $GUID "
29+ Package = " $PackageName "
30+ } - Force
31+
32+ Write-LogMessage - headers $Headers - API $APIName - message " Successfully updated template with GUID $GUID with package tag: $PackageName " - Sev ' Info'
33+ }
34+
35+ $body = [pscustomobject ]@ { ' Results' = " Successfully updated template(s) with package tag: $PackageName " }
36+
37+ } catch {
38+ $ErrorMessage = Get-CippException - Exception $_
39+ Write-LogMessage - headers $Headers - API $APIName - message " Failed to set package tag: $ ( $ErrorMessage.NormalizedError ) " - Sev ' Error' - LogData $ErrorMessage
40+ $body = [pscustomobject ]@ {' Results' = " Failed to set package tag: $ ( $ErrorMessage.NormalizedError ) " }
41+ }
42+
43+ # Associate values to output bindings by calling 'Push-OutputBinding'.
44+ Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
45+ StatusCode = [HttpStatusCode ]::OK
46+ Body = $body
47+ })
48+ }
Original file line number Diff line number Diff line change 11using namespace System.Net
22
3- Function Invoke-ListIntuneTemplates {
3+ function Invoke-ListIntuneTemplates {
44 <#
55 . FUNCTIONALITY
66 Entrypoint,AnyTenant
@@ -45,6 +45,7 @@ Function Invoke-ListIntuneTemplates {
4545 $data | Add-Member - NotePropertyName ' description' - NotePropertyValue $JSONData.Description - Force
4646 $data | Add-Member - NotePropertyName ' Type' - NotePropertyValue $JSONData.Type - Force
4747 $data | Add-Member - NotePropertyName ' GUID' - NotePropertyValue $_.RowKey - Force
48+ $data | Add-Member - NotePropertyName ' package' - NotePropertyValue $_.Package - Force
4849 $data
4950 } catch {
5051
You can’t perform that action at this time.
0 commit comments