diff --git a/CHANGELOG.md b/CHANGELOG.md index 0822154ee..b92255792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/documentation/Get-PnPTenantPronounsSetting.md b/documentation/Get-PnPTenantPronounsSetting.md new file mode 100644 index 000000000..7b7cb8bef --- /dev/null +++ b/documentation/Get-PnPTenantPronounsSetting.md @@ -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 ] +``` + +## 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) \ No newline at end of file diff --git a/documentation/Set-PnPTenantPronounsSetting.md b/documentation/Set-PnPTenantPronounsSetting.md new file mode 100644 index 000000000..9a8b40ce1 --- /dev/null +++ b/documentation/Set-PnPTenantPronounsSetting.md @@ -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 ] +``` + +## 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) \ No newline at end of file diff --git a/src/Commands/Model/Graph/PronounsSettings.cs b/src/Commands/Model/Graph/PronounsSettings.cs new file mode 100644 index 000000000..9ee982e9d --- /dev/null +++ b/src/Commands/Model/Graph/PronounsSettings.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.Graph +{ + /// + /// Contains a pronounsSettings property information + /// + /// See https://learn.microsoft.com/graph/api/resources/pronounssettings + public class PronounsSettings + { + /// + /// isEnabledInOrganization property name + /// + [JsonPropertyName("isEnabledInOrganization")] + public bool? IsPronounsEnabledInOrganization { get; set; } + + } +} diff --git a/src/Commands/PronounSettings/GetTenantPronounsSetting.cs b/src/Commands/PronounSettings/GetTenantPronounsSetting.cs new file mode 100644 index 000000000..ed791ad01 --- /dev/null +++ b/src/Commands/PronounSettings/GetTenantPronounsSetting.cs @@ -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("/v1.0/admin/people/pronouns"); + WriteObject(pronouns, false); + } + } +} diff --git a/src/Commands/PronounSettings/SetTenantPronounsSetting.cs b/src/Commands/PronounSettings/SetTenantPronounsSetting.cs new file mode 100644 index 000000000..6eb914e68 --- /dev/null +++ b/src/Commands/PronounSettings/SetTenantPronounsSetting.cs @@ -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); + } + } +}