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

💡New cmdlet - Get Tenant Pronouns Settings #4660

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `Get-PnPFileRetentionLabel` cmdlet to fetch the file retention labels. [#4603](https://github.com/pnp/powershell/pull/4603)
- Added `Get/Set/Remove-PnPUserProfilePhoto` cmdlets to download, upload or remove the profile photo of the specified user.
- Added `New/Get/Remove/Update-PnPTodoList` cmdlets to manage Todo lists.
- Added `Get-PnPTenantPronounsSetting` and `Set-PnPTenantPronounsSetting` cmdlets to manage the availability of using pronouns in the organization [#4660](https://github.com/pnp/powershell/pull/4660)

### Changed

Expand Down
57 changes: 57 additions & 0 deletions documentation/Get-PnPTenantPronounsSetting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantPronounsSetting.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPTenantPronounsSetting
---

# Get-PnPTenantPronounsSetting

## SYNOPSIS

**Required Permissions**

* Microsoft Graph API : One of PeopleSettings.Read.All, PeopleSettings.ReadWrite.All

Retrieve the current setting for the availability of using pronouns in the organization

## SYNTAX

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

## DESCRIPTION

This cmdlet can be used to retrieve tenant wide pronounsSettings properties.

## EXAMPLES

### EXAMPLE 1
```powershell
Get-PnPTenantPronounsSetting
```

Retrieves the tenant-wide pronouns settings

## 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](Get-PnPConnection.md).

```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)
[Microsoft Graph documentation](https://learn.microsoft.com/graph/api/peopleadminsettings-list-pronouns)
77 changes: 77 additions & 0 deletions documentation/Set-PnPTenantPronounsSetting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Set-PnPTenantPronounsSetting.html
external help file: PnP.PowerShell.dll-Help.xml
title: Set-PnPTenantPronounsSetting
---

# Set-PnPTenantPronounsSetting

## SYNOPSIS

**Required Permissions**

* Microsoft Graph API : PeopleSettings.ReadWrite.All

Allows allowing configuring the tenant-wide pronouns settings

## SYNTAX

```powershell
Set-PnPTenantPronounsSetting [-Connection <PnPConnection>]
```

## DESCRIPTION

Allows allowing or disallowing users configuring their own desired pronouns in their user profile.

## EXAMPLES

### EXAMPLE 1
```powershell
Set-PnPTenantPronounsSetting -IsEnabledInOrganization:$true
```

Enables allowing users to configure their own desired pronouns in their user profile.

### EXAMPLE 2
```powershell
Set-PnPTenantPronounsSetting -IsEnabledInOrganization:$false
```

Disables users from configuring their own desired pronouns in their user profile.

## 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](Get-PnPConnection.md).

```yaml
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -IsEnabledInOrganization
Provide $true to allow end users to set their desired pronounce, provide $false to prevent end users from setting their desired pronouns.

```yaml
Type: PnPConnection
Parameter Sets: (All)
Required: True
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 Graph documentation](https://learn.microsoft.com/graph/api/peopleadminsettings-list-pronouns)
18 changes: 18 additions & 0 deletions src/Commands/Model/Graph/PronounsSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.Graph
{
/// <summary>
/// Contains a pronounsSettings property information
/// </summary>
/// <remarks>See https://learn.microsoft.com/graph/api/resources/pronounssettings</remarks>
public class PronounsSettings
{
/// <summary>
/// isEnabledInOrganization property name
/// </summary>
[JsonPropertyName("isEnabledInOrganization")]
public bool? IsPronounsEnabledInOrganization { get; set; }

}
}
19 changes: 19 additions & 0 deletions src/Commands/PronounSettings/GetTenantPronounsSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using PnP.PowerShell.Commands.Attributes;
using PnP.PowerShell.Commands.Base;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.PronounSettings
{
[Cmdlet(VerbsCommon.Get, "PnPTenantPronounsSetting")]
[RequiredApiDelegatedOrApplicationPermissions("graph/PeopleSettings.Read.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/PeopleSettings.ReadWrite.All")]
[OutputType(typeof(Model.Graph.PronounsSettings))]
public class GetTenantPronounsSetting : PnPGraphCmdlet
{
protected override void ExecuteCmdlet()
{
var pronouns = RequestHelper.Get<Model.Graph.PronounsSettings>("/v1.0/admin/people/pronouns");
WriteObject(pronouns, false);
}
}
}
20 changes: 20 additions & 0 deletions src/Commands/PronounSettings/SetTenantPronounsSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using PnP.PowerShell.Commands.Attributes;
using PnP.PowerShell.Commands.Base;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.PronounSettings
{
[Cmdlet(VerbsCommon.Set, "PnPTenantPronounsSetting")]
[RequiredApiDelegatedOrApplicationPermissions("graph/PeopleSettings.ReadWrite.All")]
[OutputType(typeof(Model.Graph.PronounsSettings))]
public class SetTenantPronounsSetting : PnPGraphCmdlet
{
[Parameter(Mandatory = true)]
public bool IsEnabledInOrganization { get; set; }
protected override void ExecuteCmdlet()
{
var pronouns = RequestHelper.Patch("/v1.0/admin/people/pronouns", new Model.Graph.PronounsSettings { IsPronounsEnabledInOrganization = IsEnabledInOrganization });
WriteObject(pronouns, false);
}
}
}
Loading