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

Update PowerShell version requirements and added warning about SendEmail API retirement #4558

Merged
merged 1 commit into from
Nov 19, 2024
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Changed

- **PnP PowerShell is now .NET 8.0 based, and requires PowerShell 7.4.3 or newer **
- **PnP PowerShell is now .NET 8.0 based, and requires PowerShell 7.4.4 or newer **
- **`-Interactive` login is now the default.**
- In case of errors when Graph batch method is used, it will now throw a clearer error message about what was the issue. [#4327](https://github.com/pnp/powershell/pull/4327/)
- `Get-PnPAccessToken`, `Request-PnPAccessToken` and `Get-PnPGraphAccessToken` output type is changed to `Microsoft.IdentityModel.JsonWebTokens.JsonWebToken`. Earlier they returned `System.IdentityModel.Tokens.Jwt`.
Expand All @@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- When passing in an existing connection using `-Connection` on `Connect-PnPOnline`, the clientid from the passed in connection will be used for the new connection [#4425](https://github.com/pnp/powershell/pull/4425)
- Removed `-Confirm` parameter from `Remove-PnPUser` and `Remove-PnPAvailableSiteClassification` cmdlets. Use `-Force` instead. [#4455](https://github.com/pnp/powershell/pull/4455)
- `Get-PnPFile` now also supports passing in a full SharePoint Online URL [#4480](https://github.com/pnp/powershell/pull/4480)
- `Send-PnPMail` now throws a warning about the retirement of the SharePoint SendEmail API.

### Fixed

Expand All @@ -81,6 +82,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed `Get-PnPPowerPlatformConnector` alias. You need to use `Get-PnPPowerPlatformCustomConnector`. [#4387](https://github.com/pnp/powershell/pull/4387)
- Removed `-IsFavoriteByDefault` parameter from `Add-PnPTeamsChannel` cmdlet. It was obsolete and not supported by Graph API. [#4387](https://github.com/pnp/powershell/pull/4387)
- Removed `Get-PnPAppAuthAccessToken` , `Remove-PnPGraphAccessToken` and `Request-PnPAccessToken` cmdlets. Use `Get-PnPAccessToken` instead. [#4398](https://github.com/pnp/powershell/pull/4398)
- Removed support for sending mail via SMTP. It's usage is not recommended by .NET due to its lack of support for modern protocols.

### Contributors

Expand Down
9 changes: 6 additions & 3 deletions MIGRATE-2.0-to-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

_This is a draft document, version 3 is not yet available. You can try this out with the nightly builds starting from 2.99.1 or later_

The 3.x version of PnP PowerShell is based exclusively on .NET 8.0, which means that it will not work on older PowerShell editions like PowerShell 5.1, ISE or PowerShell 7.3 or older. It will work only on **PowerShell 7.4 or later editions.**
The 3.x version of PnP PowerShell is based exclusively on .NET 8.0, which means that it will not work on older PowerShell editions like PowerShell 5.1, ISE or PowerShell 7.3 or older. It will work only on **PowerShell 7.4.4 or later editions.**

## Steps to update from 2.x to 3.x

Expand All @@ -16,7 +16,7 @@ Or

- For Mac OS environments, please use [this link](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos)

Once the PowerShell 7.4 or later is downloaded and installed in the environment, you can install the PnP PowerShell module like you normally do.
Once the PowerShell 7.4.4 or later is downloaded and installed in the environment, you can install the PnP PowerShell module like you normally do.

```powershell
Install-Module -Name "PnP.PowerShell"
Expand All @@ -30,7 +30,7 @@ Install-Module -Name "PnP.PowerShell" -AllowPrerelease

## Changes needed in Azure DevOps/GitHub Actions/Pipelines

If you are using PnP PowerShell in Azure Devops, GitHub Actions or other pipeline infrastructure, you will have to update your PowerShell version from v5 to v7.4 or later.
If you are using PnP PowerShell in Azure Devops, GitHub Actions or other pipeline infrastructure, you will have to update your PowerShell version from v5 to v7.4.4 or later.

Recommend referring to these 2 links:

Expand All @@ -54,6 +54,9 @@ Recommend referring to these 2 links:
| Get-PnPGraphAccessToken | It has been removed. Use `Get-PnPAccessToken` instead. |
| Remove-PnPUser | The parameter `-Confirm` has been removed. Use `-Force` instead. |
| Remove-PnPAvailableSiteClassification | The parameter `-Confirm` has been removed. Use `-Force` instead. |
| Send-PnPMail | It now throws a warning about the retirement of SharePoint SendEmail API, if you are sending mails via SharePoint. To ignore it, use `-ErrorAction SilentlyContinue` along side the cmdlet. |
| Send-PnPMail | The support for sending mails via SMTP servers is now removed. It is the recommendation of .NET as SMTP doesn't support modern protocols. So, the parameters `-EnableSSL` , `-UserName`, `-Password`, `-Server ` and `-ServerPort` are now removed. Use `Send-PnPMail` with [Microsoft Graph](https://pnp.github.io/powershell/cmdlets/Send-PnPMail.html#send-through-microsoft-graph) |


## Other notable changes

Expand Down
105 changes: 4 additions & 101 deletions documentation/Send-PnPMail.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ Send-PnPMail -From <String> -To <String[]> -Subject <String> -Body <String> [-Cc
Send-PnPMail -To <String[]> -Subject <String> -Body <String> [-Cc <String[]>] [-Bcc <String[]>] [-Connection <PnPConnection>] [-Verbose]
```

### Send through SMTP

```powershell
Send-PnPMail -Server <String> -From <String> -To <String[]> -Subject <String> -Body <String> [-Cc <String[]>] [-Bcc <String[]>] [-Importance <MessageImportanceType>] [-BodyContentType <MessageBodyContentType>] [-ServerPort <short>] [-EnableSsl <bool>] [-Username <String>] [-Password <String>] [-Connection <PnPConnection>] [-Verbose]
```

## DESCRIPTION

Allows sending an e-mail through SharePoint Online, SMTP or Microsoft Graph. Sending e-mail through Microsoft Graph requires the Mail.Send permission.
Allows sending an e-mail through SharePoint Online or Microsoft Graph. Sending e-mail through Microsoft Graph requires the **Mail.Send** permission.

## EXAMPLES

Expand All @@ -59,27 +53,6 @@ Send-PnPMail -To "[email protected]" -Subject "Test message" -B

Sends an e-mail using the SharePoint Online SendEmail method using the current context. E-mail is sent from the SharePoint Online no-reply e-mail address and can only be sent to accounts in the same tenant. The from address will show the title of the site you are connected with along with the e-mail address [email protected].

### EXAMPLE 4
```powershell
Send-PnPMail -From "[email protected]" -To "[email protected]" -Subject "Test message" -Body "This is a test message" -Server contoso.mail.protection.outlook.com
```

Sends an e-mail via the SMTP service belonging to a specific tenant. E-mail is sent from the user specified in the From parameter and can be sent only to addresses residing in the tenant you address through the Server parameter, in this case contoso.

### EXAMPLE 5
```powershell
Send-PnPMail -From "[email protected]" -To "[email protected]" -Subject "Test message" -Body "This is a test message" -Server smtp.myisp.com
```

Sends an e-mail via a custom SMTP server of your Internet Service Provider which does not require authentication and uses port TCP 25. E-mail is sent from the user specified in the From parameter and can be sent to both internal and external addresses.

### EXAMPLE 6
```powershell
Send-PnPMail -From "[email protected]" -To "[email protected]" -Subject "Test message" -Body "This is a test message" -Server smtp.myisp.com -Port 587 -EnableSsl:$true -Username "userxyz" -Password "password123"
```

Sends an e-mail via a custom SMTP server of your Internet Service Provider which requires authentication and uses SSL over port TCP 587. E-mail is sent from the user specified in the From parameter and can be sent to both internal and external addresses.

## PARAMETERS

### -Body
Expand Down Expand Up @@ -129,7 +102,7 @@ Allows defining what type of content is in the Body parameter. Defaults to HTML.

```yaml
Type: MessageBodyContentType
Parameter Sets: Send through Microsoft Graph, Send through SMTP
Parameter Sets: Send through Microsoft Graph
Accepted values: Html, Text

Required: False
Expand All @@ -153,26 +126,12 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -EnableSsl
Allows you to specify if SSL should be used when connecting to the SMTP server. Only used when the Server parameter is specified.

```yaml
Type: Boolean
Parameter Sets: Send through SMTP

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -From
The sender of the e-mail. When Microsoft Graph is used, this can be a user or a shared mailbox.

```yaml
Type: String
Parameter Sets: Send through SMTP, Send through Microsoft Graph
Parameter Sets: Send through Microsoft Graph

Required: True
Position: Named
Expand All @@ -186,7 +145,7 @@ Allows defining what the importance of the e-mail is. Defaults to Normal.

```yaml
Type: MessageImportanceType
Parameter Sets: Send through Microsoft Graph, Send through SMTP
Parameter Sets: Send through Microsoft Graph
Accepted values: Low, Normal, High

Required: False
Expand All @@ -196,34 +155,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Username
Username to use to authenticate to the outbound mailserver. Only used when the Server parameter is specified and if not provided, an anonymous connection will be made with the SMTP server specified through Server.

```yaml
Type: String
Parameter Sets: Send through SMTP

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Password
Password to use to authenticate to the outbound mailserver. Only used when the Server parameter is specified and if not provided, an anonymous connection will be made with the SMTP server specified through Server.

```yaml
Type: String
Parameter Sets: Send through SMTP

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ReplyTo
List of return addresses to use for the e-mail

Expand Down Expand Up @@ -252,34 +183,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Server
SMTP server to use to send the e-mail. You can use the SMTP server of your Internet Service Provider or the SMTP server of your tenant by using tenant.mail.protection.outlook.com where you replace tenant with your own tenant name. This allows you to send e-mail without requiring any authentication, but only to recipients in that tenant. Use a custom SMTP server if you want to send e-mail to various external recipients or go for the Microsoft Graph option in which case you don't specify a server.

```yaml
Type: String
Parameter Sets: Send through SMTP

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ServerPort
SMTP server port to use to send the e-mail. Used in combination with the Server parameter. Defaults to 25.

```yaml
Type: String
Parameter Sets: Send through SMTP

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Subject
Subject of the email

Expand Down
4 changes: 2 additions & 2 deletions pages/articles/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installing PnP PowerShell

You need PowerShell 7.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).
You need PowerShell 7.4.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).

## Stable build

Expand Down Expand Up @@ -34,7 +34,7 @@ docker run -it m365pnp/powershell

# Updating PnP PowerShell

If you already have PnP PowerShell installed and just want to update to the latest version you can follow these steps. If you're not sure if your version is already up to date, it does no harm to run it anyway. If there's no new version available, it will not do anything. You need PowerShell 7.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).
If you already have PnP PowerShell installed and just want to update to the latest version you can follow these steps. If you're not sure if your version is already up to date, it does no harm to run it anyway. If there's no new version available, it will not do anything. You need PowerShell 7.4.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).

## Stable build

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/PnP.PowerShell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows'">
<PackageReference Include="System.Management.Automation" Version="7.4.4" />
<PackageReference Include="System.Management.Automation" Version="7.4.4" />
<PackageReference Include="TextCopy" Version="6.2.1" />
</ItemGroup>

Expand Down
Loading
Loading