Public/Set-ViewGroupData.ps1

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
#Requires -Modules 'MilestonePSTools'

function Set-ViewGroupData {
    <#
    .SYNOPSIS
        Sets the ViewGroupData by submitting changes to the Management Server through the IServerCommandService interface
    .DESCRIPTION
        ViewGroupData contains a ViewGroupDataXml property which contains the definition for all views and groups
        within a Public View Group shared by one or more roles. This cmdlet will call SetViewGroupData on the
        IServerCommandService interface, updating the ViewGroupData with the contents of the object supplied to this cmdlet.
    .EXAMPLE
        PS C:\> $manuallyModifiedViewGroupData | Set-ViewGroupData
        Explanation of what the example does
    .INPUTS
        [VideoOS.Common.Proxy.Server.WCF.ViewGroupInternal] object obtained through a call to Get-ViewGroupData
    .NOTES
        General notes
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')]
    param (
        [Parameter(ValueFromPipeline)]
        [VideoOS.Common.Proxy.Server.WCF.ViewGroupInternal]
        $ViewGroupData
    )

    begin {
        $svc = Get-IServerCommandService
    }

    process {
        if ($PSCmdlet.ShouldProcess("Public View Group '$($ViewGroupData.ViewGroupInfo.Name)'", "Update")) {
            $svc.SetViewGroupData((Get-Token), $ViewGroupData.ViewGroupInfo.Id, $ViewGroupData.ViewGroupData)
        }
    }
}