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

Feature: added some capability around personal lists #1545

Merged
merged 5 commits into from
Jan 27, 2022
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `Get\New\Remove\Set-PnPMicrosoft365GroupSettings` cmdlets to interact with Microsoft 365 Group settings.
- Added `Get-PnPMicrosoft365GroupSettingTemplates` cmdlet to retrieve system wide Microsoft 365 Group setting templates.
- Added `Add\Remove\Invoke-PnPListDesign` cmdlets to add a list design, remove a list design and apply the list design.
- Added `DisablePersonalListCreation` parameter to `Set-PnPTenant` cmdlet to provide ability to disable personal lists creation [#1545](https://github.com/pnp/powershell/pull/1545)
- Added `DisabledModernListTemplateIds` and `EnableModernListTemplateIds` parameters to `Set-PnPTenant` cmdlet to provide ability to disable or enable modern lists with specific Ids [#1545](https://github.com/pnp/powershell/pull/1545)
- Added `DisablePersonalListCreation` and `DisabledModernListTemplateIds` values to be displayed when using `Get-PnPTenant` cmdlet [#1545](https://github.com/pnp/powershell/pull/1545)
- Added `Add\Remove\Set-PnPAdaptiveScopeProperty` cmdlets to add/update/remove a property bag value while dealing with the noscript toggling in one cmdlet [#1556](https://github.com/pnp/powershell/pull/1556)
- Added support to add multiple owners and members in `New-PnPTeamsTeam` cmdlet [#1241](https://github.com/pnp/powershell/pull/1241)
- Added the ability to set the title of a new modern page in SharePoint Online using `Add-PnPPage` to be different from its filename by using `-Title`
Expand Down
3 changes: 1 addition & 2 deletions documentation/Get-PnPTenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ Accept wildcard characters: False

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
44 changes: 43 additions & 1 deletion documentation/Set-PnPTenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,48 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -DisablePersonalListCreation
Allows configuring whether personal lists created within the OneDrive for Business site of the user is enabled or disabled in the tenant. If set to `$true`, personal lists will be allowed to be created in the tenant. If set to `$false`, it will be disabled in the tenant.

```yaml
Type: Boolean
Parameter Sets: (All)

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

### -DisabledModernListTemplateIds
Guids of out of the box modern list templates to hide when creating a new list

```yaml
Type: Guid[]
Parameter Sets: (All)

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

### -EnableModernListTemplateIds
Guids of out of the box modern liststemplates to show when creating a new list

```yaml
Type: Guid[]
Parameter Sets: (All)

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

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
41 changes: 40 additions & 1 deletion src/Commands/Admin/SetTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Management.Automation;
using System;
using Microsoft.Online.SharePoint.TenantManagement;
using System.Collections.Generic;

namespace PnP.PowerShell.Commands.Admin
{
Expand Down Expand Up @@ -221,7 +222,7 @@ public class SetTenant : PnPAdminCmdlet

[Parameter(Mandatory = false)]
public bool? InformationBarriersSuspension;

[Parameter(Mandatory = false)]
public bool? AllowFilesWithKeepLabelToBeDeletedSPO;

Expand All @@ -235,6 +236,15 @@ public class SetTenant : PnPAdminCmdlet
[Parameter(Mandatory = false)]
public bool? IsFluidEnabled;

[Parameter(Mandatory = false)]
public bool? DisablePersonalListCreation;

[Parameter(Mandatory = false)]
public Guid[] DisabledModernListTemplateIds;

[Parameter(Mandatory = false)]
public Guid[] EnableModernListTemplateIds;

protected override void ExecuteCmdlet()
{
ClientContext.Load(Tenant);
Expand Down Expand Up @@ -876,10 +886,39 @@ protected override void ExecuteCmdlet()
modified = true;
}

if (DisablePersonalListCreation.HasValue)
{
Tenant.DisablePersonalListCreation = DisablePersonalListCreation.Value;
modified = true;
}

if (DisabledModernListTemplateIds != null && DisabledModernListTemplateIds.Length > 0)
{
Tenant.DisabledModernListTemplateIds = DisabledModernListTemplateIds;
modified = true;
}

if (modified)
{
ClientContext.ExecuteQueryRetry();
}

if (EnableModernListTemplateIds != null && EnableModernListTemplateIds.Length > 0)
{
Tenant.EnsureProperty(t => t.DisabledModernListTemplateIds);
List<Guid> disabledListTemplateIds = new List<Guid>(Tenant.DisabledModernListTemplateIds);
Guid[] disableModernListTemplateIds = EnableModernListTemplateIds;
foreach (Guid templateId in disableModernListTemplateIds)
{
if (templateId != Guid.Empty)
{
disabledListTemplateIds.Remove(templateId);
}
}

Tenant.DisabledModernListTemplateIds = disabledListTemplateIds.ToArray();
ClientContext.ExecuteQueryRetry();
}
}
}
}
25 changes: 21 additions & 4 deletions src/Commands/Model/SPOTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)
catch
{
this.disableCustomAppAuthentication = false;
}
}
this.markNewFilesSensitiveByDefault = tenant.MarkNewFilesSensitiveByDefault;
try
{
Expand All @@ -374,10 +374,21 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)
{
this.isFluidEnabled = false;
}
try
{
this.disablePersonalListCreation = tenant.DisablePersonalListCreation;
}
catch
{
this.disablePersonalListCreation = false;
}

this.disabledModernListTemplateIds = tenant.DisabledModernListTemplateIds;

try
{
var getAllowFilesWithKeepLabelToBeDeletedSPO = Microsoft.SharePoint.Client.CompliancePolicy.SPPolicyStoreProxy.GetAllowFilesWithKeepLabelToBeDeletedSPO(clientContext);
var getAllowFilesWithKeepLabelToBeDeletedODB = Microsoft.SharePoint.Client.CompliancePolicy.SPPolicyStoreProxy.GetAllowFilesWithKeepLabelToBeDeletedODB(clientContext);
var getAllowFilesWithKeepLabelToBeDeletedODB = Microsoft.SharePoint.Client.CompliancePolicy.SPPolicyStoreProxy.GetAllowFilesWithKeepLabelToBeDeletedODB(clientContext);
clientContext.ExecuteQueryRetry();

this.allowFilesWithKeepLabelToBeDeletedSPO = getAllowFilesWithKeepLabelToBeDeletedSPO.Value;
Expand Down Expand Up @@ -533,6 +544,9 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)
public bool DisableAddToOneDrive => disableAddToOneDrive;

public bool IsFluidEnabled => isFluidEnabled;
public bool DisablePersonalListCreation => disablePersonalListCreation;

public Guid[] DisabledModernListTemplateIds => disabledModernListTemplateIds;

private bool hideDefaultThemes;

Expand Down Expand Up @@ -666,13 +680,12 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)

private bool disableCustomAppAuthentication;

private SensitiveByDefaultState markNewFilesSensitiveByDefault;
private SensitiveByDefaultState markNewFilesSensitiveByDefault;

private bool stopNew2013Workflows;

private bool viewInFileExplorerEnabled;


private bool disableSpacesActivation;

private bool? allowFilesWithKeepLabelToBeDeletedSPO;
Expand All @@ -683,5 +696,9 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)

private bool isFluidEnabled;

private bool disablePersonalListCreation;

private Guid[] disabledModernListTemplateIds;

}
}