Skip to content

Commit 00ac986

Browse files
gautamdshethGautam Sheth
and
Gautam Sheth
authored
Update documentation for New-PnPVivaEngageCommunity and Send-PnPMail cmdlets to include -Owners parameter and simplify parameter sets (#4922)
Co-authored-by: Gautam Sheth <[email protected]>
1 parent 4b9579a commit 00ac986

File tree

3 files changed

+35
-21
lines changed

3 files changed

+35
-21
lines changed

documentation/New-PnPVivaEngageCommunity.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Creates a Viva engage community
1515
## SYNTAX
1616

1717
```powershell
18-
New-PnPVivaEngageCommunity [[-DisplayName] <string> [-Description] <string> [-Privacy] <CommunityPrivacy>] [-Connection <PnPConnection>]
18+
New-PnPVivaEngageCommunity [[-DisplayName] <string> [-Description] <string> [-Privacy] <CommunityPrivacy>] [-Owners <string[]>] [-Connection <PnPConnection>]
1919
```
2020

2121
## DESCRIPTION
@@ -89,6 +89,20 @@ Accept pipeline input: True (ByValue)
8989
Accept wildcard characters: False
9090
```
9191
92+
### -Owners
93+
The owners of the Viva engage community. This is mandatory if application permissions are used else the request will fail.
94+
95+
```yaml
96+
Type: String[]
97+
Parameter Sets: (All)
98+
99+
Required: False
100+
Position: Named
101+
Default value: None
102+
Accept pipeline input: True (ByValue)
103+
Accept wildcard characters: False
104+
```
105+
92106
## RELATED LINKS
93107
94108
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

documentation/Send-PnPMail.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Allows defining what type of content is in the Body parameter. Defaults to HTML.
124124
125125
```yaml
126126
Type: MessageBodyContentType
127-
Parameter Sets: Send through Microsoft Graph with attachments from SPO, Send through Microsoft Graph with attachments from local file system
127+
Parameter Sets: Send through Microsoft Graph
128128
Accepted values: Html, Text
129129

130130
Required: False
@@ -153,7 +153,7 @@ The sender of the e-mail. When Microsoft Graph is used, this can be a user or a
153153
154154
```yaml
155155
Type: String
156-
Parameter Sets: Send through Microsoft Graph with attachments from SPO, Send through Microsoft Graph with attachments from local file system
156+
Parameter Sets: Send through Microsoft Graph
157157

158158
Required: True
159159
Position: Named
@@ -167,7 +167,7 @@ Allows defining what the importance of the e-mail is. Defaults to Normal.
167167
168168
```yaml
169169
Type: MessageImportanceType
170-
Parameter Sets: Send through Microsoft Graph with attachments from SPO, Send through Microsoft Graph with attachments from local file system
170+
Parameter Sets: Send through Microsoft Graph
171171
Accepted values: Low, Normal, High
172172

173173
Required: False
@@ -182,7 +182,7 @@ List of return addresses to use for the e-mail
182182
183183
```yaml
184184
Type: String[]
185-
Parameter Sets: Send through Microsoft Graph with attachments from SPO, Send through Microsoft Graph with attachments from local file system
185+
Parameter Sets: Send through Microsoft Graph
186186

187187
Required: False
188188
Position: Named
@@ -196,7 +196,7 @@ Allows indicating if the sent e-mail should be stored in the Sent Items of the m
196196
197197
```yaml
198198
Type: String[]
199-
Parameter Sets: Send through Microsoft Graph with attachments from SPO, Send through Microsoft Graph with attachments from local file system
199+
Parameter Sets: Send through Microsoft Graph
200200

201201
Required: False
202202
Position: Named
@@ -238,7 +238,7 @@ List of attachments from local file system to be uploaded and sent as attachment
238238
239239
```yaml
240240
Type: String[]
241-
Parameter Sets: Send through Microsoft Graph with attachments from local file system
241+
Parameter Sets: Send through Microsoft Graph
242242

243243
Required: False
244244
Position: Named
@@ -252,7 +252,7 @@ List of files from the SharePoint site collection to be sent as attachments.
252252
253253
```yaml
254254
Type: String[]
255-
Parameter Sets: Send through Microsoft Graph with attachments from SPO
255+
Parameter Sets: Send through Microsoft Graph
256256

257257
Required: False
258258
Position: Named

src/Commands/Utilities/SendMail.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,63 +10,63 @@ namespace PnP.PowerShell.Commands.Utilities
1010
[Cmdlet(VerbsCommunications.Send, "PnPMail", DefaultParameterSetName = ParameterSet_SENDTHROUGHSPO)]
1111
public class SendMail : PnPWebCmdlet
1212
{
13-
private const string ParameterSet_SENDTHROUGHGRAPH = "Send through Microsoft Graph with attachments from local file system";
1413
private const string ParameterSet_SENDTHROUGHSPO = "Send through SharePoint Online";
15-
private const string ParameterSet_SENDTHROUGHGRAPHWITHFILES = "Send through Microsoft Graph with attachments from SPO";
14+
private const string ParameterSet_SENDTHROUGHGRAPH = "Send through Microsoft Graph";
1615

1716
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
18-
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
1917
public string From;
2018

2119
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
2220
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHSPO)]
23-
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
2421
public string[] To;
2522

2623
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
2724
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHSPO)]
28-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
2925
public string[] Cc;
3026

3127
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
3228
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHSPO)]
33-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
3429
public string[] Bcc;
3530

3631
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
3732
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHSPO)]
38-
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
3933
public string Subject;
4034

4135
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
4236
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHSPO)]
43-
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
4437
public string Body;
4538

4639
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
47-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
4840
public MessageImportanceType Importance;
4941

5042
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
51-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
5243
public string[] ReplyTo;
5344

5445
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
55-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
5646
public bool? SaveToSentItems;
5747

5848
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
59-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
6049
public MessageBodyContentType? BodyContentType;
6150

6251
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
6352
public string[] Attachments;
6453

65-
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPHWITHFILES)]
54+
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SENDTHROUGHGRAPH)]
6655
public FilePipeBind[] Files;
6756

6857
protected override void ExecuteCmdlet()
6958
{
59+
// Runtime validation to prevent both attachment types being used together
60+
if (ParameterSpecified(nameof(Attachments)) && ParameterSpecified(nameof(Files)))
61+
{
62+
ThrowTerminatingError(new ErrorRecord(
63+
new PSArgumentException("You cannot use both -Attachments and -Files parameters together."),
64+
"SendMailAttachmentConflict",
65+
ErrorCategory.InvalidArgument,
66+
this));
67+
return;
68+
}
69+
7070
if (string.IsNullOrWhiteSpace(From))
7171
{
7272
LogDebug("Sending e-mail through SharePoint Online");

0 commit comments

Comments
 (0)