Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `-UserAssignedManagedIdentityAzureResourceId` and `-UserAssignedManagedIdentityClientId` as alternatives to `-UserAssignedManagedIdentityObjectId` for `Connect-PnPOnline -ManagedIdentity` to provide an user managed identity to authenticate with. [#2813](https://github.com/pnp/powershell/pull/2813)
- Added clearer error message when connecting using an expired client secret and trying to execute a command.[#2828](https://github.com/pnp/powershell/pull/2828)
- Added `Undo-PnPFileCheckedOut` which allows a checked out file to discard its changes and revert to the last checked in version. [#2837](https://github.com/pnp/powershell/pull/2837)
- Added `-OpenDocumentsMode` option to `Set-PnPList` which allows configuring if documents should be opened in the browser or in the local client [#2873](https://github.com/pnp/powershell/pull/2873)
- Added `-Properties` parameter to `Get-PnPUserProfileProperty` cmdlet which allows retrieval of specific properties if specified. [#2840](https://github.com/pnp/powershell/pull/2840)
- Added support for specifying the `-ContentUrl` configuration in `Add-PnPTeamsTab` cmdlet when trying to add a Planner as a tab in Teams channel. [#2850](https://github.com/pnp/powershell/pull/2850)

Expand Down
17 changes: 16 additions & 1 deletion documentation/Set-PnPList.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Set-PnPList -Identity <ListPipeBind> [-EnableContentTypes <Boolean>] [-BreakRole
[-EnableMinorVersions <Boolean>] [-MajorVersions <UInt32>] [-MinorVersions <UInt32>]
[-EnableModeration <Boolean>] [-DraftVersionVisibility <DraftVisibilityType>] [-ReadSecurity <ListReadSecurity>] [-WriteSecurity <ListWriteSecurity>]
[-NoCrawl] [-ExemptFromBlockDownloadOfNonViewableFiles <Boolean>] [-DisableGridEditing <Boolean>] [-DefaultSensitivityLabelForLibrary <SensitivityLabelPipeBind>]
[-Path <String>] [-Connection <PnPConnection>] [<CommonParameters>]
[-Path <String>] [-OpenDocumentsMode <DocumentLibraryOpenDocumentsInMode>] [-Connection <PnPConnection>]
```

## DESCRIPTION
Expand Down Expand Up @@ -369,6 +369,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -OpenDocumentsMode
Allows configuring the opening documents in the browser advanced setting on document libraries. Set to ClientApplication to have documents being opened in the locally installed Word, PowerPoint or Excel client or set to Browser to have documents being opened in the browser. It is not possible to set it to "Use the server default mode".

```yaml
Type: DocumentLibraryOpenDocumentsInMode
Parameter Sets: (All)
Accepted values: ClientApplication, Browser

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

### -ReadSecurity
Sets the read security for the list

Expand Down
18 changes: 18 additions & 0 deletions src/Commands/Enums/DocumentLibraryOpenDocumentsInMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace PnP.PowerShell.Commands.Enums
{
/// <summary>
/// Defines the modes that can be set on a Document Library for how to open documents
/// </summary>
public enum DocumentLibraryOpenDocumentsInMode : short
{
/// <summary>
/// Opens the document in the client application, i.e. Word, Excel, PowerPoint, etc. on the local desktop
/// </summary>
ClientApplication = 0,

/// <summary>
/// Opens the document in the browser
/// </summary>
Browser = 1
}
}
44 changes: 42 additions & 2 deletions src/Commands/Lists/SetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ public class SetList : PnPWebCmdlet
public string Path;

[Parameter(Mandatory = false)]
public SensitivityLabelPipeBind DefaultSensitivityLabelForLibrary;
public SensitivityLabelPipeBind DefaultSensitivityLabelForLibrary;

[Parameter(Mandatory = false)]
public DocumentLibraryOpenDocumentsInMode OpenDocumentsMode;

protected override void ExecuteCmdlet()
{
Expand Down Expand Up @@ -240,7 +243,7 @@ protected override void ExecuteCmdlet()

if (list.EnableVersioning)
{
// list or doclib?
// Is this for a list or a document library
if (list.BaseType == BaseType.DocumentLibrary)
{
if (ParameterSpecified(nameof(MajorVersions)))
Expand Down Expand Up @@ -307,6 +310,43 @@ protected override void ExecuteCmdlet()
}
}

if(ParameterSpecified(nameof(OpenDocumentsMode)))
{
// Is this for a list or a document library
if (list.BaseType == BaseType.DocumentLibrary)
{
WriteVerbose($"Configuring document library to use default open mode to be '{OpenDocumentsMode}'");

switch(OpenDocumentsMode)
{
case DocumentLibraryOpenDocumentsInMode.Browser:
list.DefaultItemOpenInBrowser = true;
break;

case DocumentLibraryOpenDocumentsInMode.ClientApplication:
list.DefaultItemOpenInBrowser = false;
break;
}
updateRequired = true;
}
else
{
WriteWarning($"{nameof(OpenDocumentsMode)} is only supported for document libraries");
}

switch(OpenDocumentsMode)
{
case DocumentLibraryOpenDocumentsInMode.Browser:
list.DefaultItemOpenInBrowser = true;
break;

case DocumentLibraryOpenDocumentsInMode.ClientApplication:
list.DefaultItemOpenInBrowser = false;
break;
}
updateRequired = true;
}

if (updateRequired)
{
list.Update();
Expand Down