Skip to content

Commit

Permalink
Merge pull request #3233 from gautamdsheth/feature/add-ListsShowHeade…
Browse files Browse the repository at this point in the history
…rAndNavigation-param

Feature: add ListsShowHeaderAndNavigation  property to PnPTenantSite and PnPSite cmdlets
  • Loading branch information
gautamdsheth authored Jun 29, 2023
2 parents cc7fc92 + 9dc7581 commit c793e49
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
15 changes: 15 additions & 0 deletions documentation/Set-PnPSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Set-PnPSite [-Identity <String>]
[-ScriptSafeDomainName <string>]
[-BlockDownloadPolicy <Boolean>] [-ExcludeBlockDownloadPolicySiteOwners <Boolean>]
[-ExcludedBlockDownloadGroupIds <Guid[]>]
[-ListsShowHeaderAndNavigation <Boolean>]
[-Connection <PnPConnection>]
```

Expand Down Expand Up @@ -584,6 +585,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -ListsShowHeaderAndNavigation
Set a property on a site collection to make all lists always load with the site elements intact.
```yaml
Type: Boolean
Parameter Sets: Set Properties

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Wait
Wait for the operation to complete
Expand Down
15 changes: 15 additions & 0 deletions documentation/Set-PnPTenantSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Set-PnPTenantSite [-Identity] <String> [-Title <String>] [-LocaleId <UInt32>] [-
[-MediaTranscription <MediaTranscriptionPolicyType>]
[-BlockDownloadPolicy <Boolean>] [-ExcludeBlockDownloadPolicySiteOwners <Boolean>]
[-ExcludedBlockDownloadGroupIds <Guid[]>]
[-ListsShowHeaderAndNavigation <Boolean>]
[-Wait]
[-Connection <PnPConnection>]
```
Expand Down Expand Up @@ -722,6 +723,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ListsShowHeaderAndNavigation
Set a property on a site collection to make all lists always load with the site elements intact.

```yaml
Type: Boolean
Parameter Sets: Set Properties
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Wait
Wait for the operation to complete

Expand Down
9 changes: 9 additions & 0 deletions src/Commands/Admin/SetTenantSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ public class SetTenantSite : PnPAdminCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Guid[] ExcludedBlockDownloadGroupIds;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public bool? ListsShowHeaderAndNavigation;

[Parameter(Mandatory = false)]
public SwitchParameter Wait;

Expand Down Expand Up @@ -528,6 +531,12 @@ private void SetSiteProperties(Func<TenantOperationMessage, bool> timeoutFunctio
updateRequired = true;
}

if (ParameterSpecified(nameof(ListsShowHeaderAndNavigation)) && ListsShowHeaderAndNavigation.HasValue)
{
props.ListsShowHeaderAndNavigation = ListsShowHeaderAndNavigation.Value;
updateRequired = true;
}

if (updateRequired)
{
var op = props.Update();
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Base/ConnectOnline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ private static bool PingHost(string nameOrAddress)
}
return false;
}
catch(Exception ex)
catch
{
return false;
}
Expand Down
12 changes: 11 additions & 1 deletion src/Commands/Site/SetSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ public class SetSite : PnPSharePointCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Guid[] ExcludedBlockDownloadGroupIds;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public bool? ListsShowHeaderAndNavigation;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_LOCKSTATE)]
public SwitchParameter Wait;

Expand Down Expand Up @@ -397,6 +400,12 @@ protected override void ExecuteCmdlet()
executeQueryRequired = true;
}

if (ParameterSpecified(nameof(ListsShowHeaderAndNavigation)) && ListsShowHeaderAndNavigation.HasValue)
{
siteProperties.ListsShowHeaderAndNavigation = ListsShowHeaderAndNavigation.Value;
executeQueryRequired = true;
}

if (executeQueryRequired)
{
siteProperties.Update();
Expand Down Expand Up @@ -451,6 +460,7 @@ private bool IsTenantProperty() =>
RequestFilesLinkEnabled.HasValue ||
BlockDownloadPolicy.HasValue ||
ExcludeBlockDownloadPolicySiteOwners.HasValue ||
ParameterSpecified(nameof(ExcludedBlockDownloadGroupIds));
ParameterSpecified(nameof(ExcludedBlockDownloadGroupIds)) ||
ListsShowHeaderAndNavigation.HasValue;
}
}

0 comments on commit c793e49

Please sign in to comment.