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

Files for new cmdlets Set-PnPTenantRestrictedSearchMode and GetTenantRestrictedSearchMode.cs #3976

Merged
merged 5 commits into from
May 29, 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
58 changes: 58 additions & 0 deletions documentation/Get-PnPTenantRestrictedSearchMode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
Module Name: PnP.PowerShell
title: Get-PnPTenantRestrictedSearchMode
schema: 2.0.0
applicable: SharePoint Online
external help file: PnP.PowerShell.dll-Help.xml
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantRestrictedSearchMode.html
---

# Get-PnPTenantRestrictedSearchMode

## SYNOPSIS

**Required Permissions**

* Global Administrator or SharePoint Administrator

Returns Restricted Search mode.

## SYNTAX

```powershell
Get-PnPTenantRestrictedSearchMode [-Connection <PnPConnection>]
```

## DESCRIPTION

Returns Restricted Search mode. Restricted SharePoint Search is disabled by default.

## EXAMPLES

### EXAMPLE 1

```powershell
Get-PnPTenantRestrictedSearchMode
```

Returns Restricted Search mode.

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

```yaml
Type: PnPConnection
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)
83 changes: 83 additions & 0 deletions documentation/Set-PnPTenantRestrictedSearchMode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
Module Name: PnP.PowerShell
title: Set-PnPTenantRestrictedSearchMode
schema: 2.0.0
applicable: SharePoint Online
external help file: PnP.PowerShell.dll-Help.xml
online version: https://pnp.github.io/powershell/cmdlets/Set-PnPTenantRestrictedSearchMode.html
---

# Set-PnPTenantRestrictedSearchMode

## SYNOPSIS

**Required Permissions**

* Global Administrator or SharePoint Administrator

Returns Restricted Search mode.

## SYNTAX

```powershell
Set-PnPTenantRestrictedSearchMode -Mode <RestrictedSearchMode> [-Connection <PnPConnection>]
```

## DESCRIPTION

Returns Restricted Search mode. Restricted SharePoint Search is disabled by default.

## EXAMPLES

### EXAMPLE 1

```powershell
Set-PnPTenantRestrictedSearchMode -Mode Enabled
```

Sets or enables the Restricted Tenant Search mode for the tenant.

### EXAMPLE 2

```powershell
Set-PnPTenantRestrictedSearchMode -Mode Disabled
```

Disables the Restricted Tenant Search mode for the tenant.

## PARAMETERS

### -Mode

Sets the mode for the Restricted Tenant Search.

```yaml
Type: RestrictedSearchMode
Parameter Sets: (All)
Accepted values: Enabled, Disabled

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

```yaml
Type: PnPConnection
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)
18 changes: 18 additions & 0 deletions src/Commands/Admin/GetTenantRestrictedSearchMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Base;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Files
{
[Cmdlet(VerbsCommon.Get, "PnPTenantRestrictedSearchMode")]
public class GetTenantRestrictedSearchMode : PnPAdminCmdlet
{
protected override void ExecuteCmdlet()
{
var results = Tenant.GetSPORestrictedSearchMode();
AdminContext.ExecuteQueryRetry();
WriteObject(results, true);
}
}
}
19 changes: 19 additions & 0 deletions src/Commands/Admin/SetTenantRestrictedSearchMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Online.SharePoint.TenantAdministration;
using PnP.PowerShell.Commands.Base;
using Microsoft.SharePoint.Client;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Files
{
[Cmdlet(VerbsCommon.Set, "PnPTenantRestrictedSearchMode")]
public class SetTenantRestrictedSearchMode : PnPAdminCmdlet
{
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true)]
public RestrictedSearchMode mode;
protected override void ExecuteCmdlet()
{
Tenant.SetSPORestrictedSearchMode(mode);
AdminContext.ExecuteQueryRetry();
}
}
}
Loading