Skip to content

Commit 05f9461

Browse files
author
Gautam Sheth
committed
Feature: Add Set-PnPVivaEngageCommunity cmdlet for updating Viva Engage community settings
1 parent c38fe36 commit 05f9461

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
title: Set-PnPVivaEngageCommunity
4+
schema: 2.0.0
5+
applicable: SharePoint Online
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
online version: https://pnp.github.io/powershell/cmdlets/Set-PnPVivaEngageCommunity.html
8+
---
9+
10+
# Set-PnPVivaEngageCommunity
11+
12+
## SYNOPSIS
13+
Updates the Viva engage community in the tenant.
14+
15+
## SYNTAX
16+
17+
```powershell
18+
Set-PnPVivaEngageCommunity [[-Identity] <string>] [[-DisplayName] <string>] [[-Description] <string>][[-Privacy] <CommunityPrivacy>] [-Connection <PnPConnection>]
19+
```
20+
21+
## DESCRIPTION
22+
23+
Updates the Viva engage community.
24+
25+
## EXAMPLES
26+
27+
### EXAMPLE 1
28+
```powershell
29+
Set-PnPVivaEngageCommunity -Identity "eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIyMTI0ODA3MTI3MDQifQ" -DisplayName "New Viva Community"
30+
```
31+
32+
This will update the display name of the Viva Engage community in the tenant with the specified Id.
33+
34+
### EXAMPLE 2
35+
```powershell
36+
Set-PnPVivaEngageCommunity -Identity "eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiIyMTI0ODA3MTI3MDQifQ" -DisplayName "New Viva Community" -Description "Updated description" -Privacy Private
37+
```
38+
39+
This will update the display name, description and privacy setting of the Viva Engage community in the tenant with the specified Id.
40+
41+
## PARAMETERS
42+
43+
### -Connection
44+
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
45+
46+
```yaml
47+
Type: PnPConnection
48+
Parameter Sets: (All)
49+
50+
Required: False
51+
Position: Named
52+
Default value: None
53+
Accept pipeline input: False
54+
Accept wildcard characters: False
55+
```
56+
57+
### -Identity
58+
The Id of the Viva engage community.
59+
60+
```yaml
61+
Type: String
62+
Parameter Sets: (All)
63+
64+
Required: True
65+
Position: 0
66+
Default value: None
67+
Accept pipeline input: True (ByValue)
68+
Accept wildcard characters: False
69+
```
70+
71+
### -DisplayName
72+
The updated display name of the Viva engage community.
73+
74+
```yaml
75+
Type: String
76+
Parameter Sets: (All)
77+
78+
Required: False
79+
Position: Named
80+
Default value: None
81+
Accept pipeline input: True (ByValue)
82+
Accept wildcard characters: False
83+
```
84+
85+
### -Description
86+
The updated description of the Viva engage community.
87+
88+
```yaml
89+
Type: String
90+
Parameter Sets: (All)
91+
92+
Required: False
93+
Position: Named
94+
Default value: None
95+
Accept pipeline input: True (ByValue)
96+
Accept wildcard characters: False
97+
```
98+
99+
### -Privacy
100+
The updated privacy setting of the Viva engage community. Available values are `Public` and `Private`.
101+
102+
```yaml
103+
Type: CommunityPrivacy
104+
Parameter Sets: (All)
105+
106+
Required: False
107+
Position: Named
108+
Default value: None
109+
Accept pipeline input: True (ByValue)
110+
Accept wildcard characters: False
111+
```
112+
113+
## RELATED LINKS
114+
115+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using PnP.PowerShell.Commands.Attributes;
2+
using PnP.PowerShell.Commands.Base;
3+
using PnP.PowerShell.Commands.Model.VivaEngage;
4+
using System.Collections.Generic;
5+
using System.Management.Automation;
6+
7+
namespace PnP.PowerShell.Commands.Viva
8+
{
9+
[Cmdlet(VerbsCommon.Set, "PnPVivaEngageCommunity")]
10+
[RequiredApiDelegatedOrApplicationPermissions("graph/Community.ReadWrite.All")]
11+
public class UpdateVivaEngageCommunity : PnPGraphCmdlet
12+
{
13+
[Parameter(Mandatory = true, Position = 0)]
14+
public string Identity;
15+
16+
[Parameter(Mandatory = false)]
17+
public string DisplayName;
18+
19+
[Parameter(Mandatory = false)]
20+
public string Description;
21+
22+
[Parameter(Mandatory = false)]
23+
public CommunityPrivacy Privacy;
24+
protected override void ExecuteCmdlet()
25+
{
26+
string endpointUrl = $"/v1.0/employeeExperience/communities/{Identity}";
27+
28+
var postData = new Dictionary<string, string>();
29+
30+
if (ParameterSpecified(nameof(DisplayName)))
31+
{
32+
postData.Add("displayName", DisplayName);
33+
}
34+
if (ParameterSpecified(nameof(Description)))
35+
{
36+
postData.Add("description", Description);
37+
}
38+
if (ParameterSpecified(nameof(Privacy)))
39+
{
40+
postData.Add("privacy", Privacy.ToString().ToLower());
41+
}
42+
RequestHelper.Patch(endpointUrl, postData);
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)