diff --git a/CHANGELOG.md b/CHANGELOG.md index 862fc40a9..aefe23f5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed issue where using `Connect-PnPOnline` using `-Thumbnail` would delete the private key on some devices when running `Disconnect-PnPOnline` [PR #2759](https://github.com/pnp/PnP-PowerShell/pull/2759) - Fixed timeouts on `Get-PnPSiteCollectionAdmin` when the site has a lot of users [PR #2769](https://github.com/pnp/PnP-PowerShell/pull/2769) - Updated test project structure [PR #2767](https://github.com/pnp/PnP-PowerShell/pull/2767) +- All UnifiedGroup cmdlets have been renamed to Microsoft365Group. I.e. `New-PnPUnifiedGroup` -> `New-PnPMicrosoft365Group`. An alias has been added to provide for backwards compatibility [PR #2771](https://github.com/pnp/PnP-PowerShell/pull/2771) ### Contributors - Erwin van Hunen [erwinvanhunen] diff --git a/Commands/Base/PipeBinds/UnifiedGroupPipeBind.cs b/Commands/Base/PipeBinds/Microsoft365GroupPipeBind.cs similarity index 92% rename from Commands/Base/PipeBinds/UnifiedGroupPipeBind.cs rename to Commands/Base/PipeBinds/Microsoft365GroupPipeBind.cs index 170e574d7..a4aa9d021 100644 --- a/Commands/Base/PipeBinds/UnifiedGroupPipeBind.cs +++ b/Commands/Base/PipeBinds/Microsoft365GroupPipeBind.cs @@ -5,22 +5,22 @@ namespace SharePointPnP.PowerShell.Commands.Base.PipeBinds { - public class UnifiedGroupPipeBind + public class Microsoft365GroupPipeBind { private readonly UnifiedGroupEntity _group; private readonly String _groupId; private readonly String _displayName; - public UnifiedGroupPipeBind() + public Microsoft365GroupPipeBind() { } - public UnifiedGroupPipeBind(UnifiedGroupEntity group) + public Microsoft365GroupPipeBind(UnifiedGroupEntity group) { _group = group; } - public UnifiedGroupPipeBind(String input) + public Microsoft365GroupPipeBind(String input) { Guid idValue; if (Guid.TryParse(input, out idValue)) diff --git a/Commands/Graph/GetDeletedUnifiedGroup.cs b/Commands/Graph/GetDeletedMicrosoft365Group.cs similarity index 77% rename from Commands/Graph/GetDeletedUnifiedGroup.cs rename to Commands/Graph/GetDeletedMicrosoft365Group.cs index 688944165..61e987d97 100644 --- a/Commands/Graph/GetDeletedUnifiedGroup.cs +++ b/Commands/Graph/GetDeletedMicrosoft365Group.cs @@ -9,24 +9,24 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Get, "PnPDeletedUnifiedGroup")] - - [CmdletHelp("Gets one deleted Microsoft 365 Group (aka Unified Group) or a list of deleted Microsoft 365 Groups", + [Cmdlet(VerbsCommon.Get, "PnPDeletedMicrosoft365Group")] + [Alias("Get-PnPDeletedUnifiedGroup")] + [CmdletHelp("Gets one deleted Microsoft 365 Group or a list of deleted Microsoft 365 Groups", Category = CmdletHelpCategory.Graph, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Get-PnPDeletedUnifiedGroup", + Code = "PS:> Get-PnPDeletedMicrosoft365Group", Remarks = "Retrieves all deleted Microsoft 365 Groups", SortOrder = 1)] [CmdletExample( - Code = "PS:> Get-PnPDeletedUnifiedGroup -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f", + Code = "PS:> Get-PnPDeletedMicrosoft365Group -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f", Remarks = "Retrieves a specific deleted Microsoft 365 Group based on its ID", SortOrder = 2)] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_ReadWrite_All | MicrosoftGraphApiPermission.Group_Read_All)] - public class GetDeletedUnifiedGroup : PnPGraphCmdlet + public class GetDeletedMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = false, HelpMessage = "The Identity of the Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; protected override void ExecuteCmdlet() { diff --git a/Commands/Graph/GetUnifiedGroup.cs b/Commands/Graph/GetMicrosoft365Group.cs similarity index 82% rename from Commands/Graph/GetUnifiedGroup.cs rename to Commands/Graph/GetMicrosoft365Group.cs index 6a384d9b5..94d78f2e6 100644 --- a/Commands/Graph/GetUnifiedGroup.cs +++ b/Commands/Graph/GetMicrosoft365Group.cs @@ -9,40 +9,41 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Get, "PnPUnifiedGroup")] - [CmdletHelp("Gets one Microsoft 365 Group (aka Unified Group) or a list of Microsoft 365 Groups. Requires the Azure Active Directory application permission 'Group.Read.All'.", + [Cmdlet(VerbsCommon.Get, "PnPMicrosoft365Group")] + [Alias("Get-PnPUnifiedGroup")] + [CmdletHelp("Gets one Microsoft 365 Group or a list of Microsoft 365 Groups", Category = CmdletHelpCategory.Graph, OutputTypeLink = "https://docs.microsoft.com/graph/api/group-list", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup", + Code = "PS:> Get-Microsoft365Group", Remarks = "Retrieves all the Microsoft 365 Groups", SortOrder = 1)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup -Identity $groupId", + Code = "PS:> Get-Microsoft365Group -Identity $groupId", Remarks = "Retrieves a specific Microsoft 365 Group based on its ID", SortOrder = 2)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup -Identity $groupDisplayName", + Code = "PS:> Get-Microsoft365Group -Identity $groupDisplayName", Remarks = "Retrieves a specific or list of Microsoft 365 Groups that start with the given DisplayName", SortOrder = 3)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup -Identity $groupSiteMailNickName", + Code = "PS:> Get-Microsoft365Group -Identity $groupSiteMailNickName", Remarks = "Retrieves a specific or list of Microsoft 365 Groups for which the email starts with the provided mail nickName", SortOrder = 4)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup -Identity $group", + Code = "PS:> Get-Microsoft365Group -Identity $group", Remarks = "Retrieves a specific Microsoft 365 Group based on its object instance", SortOrder = 5)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup -IncludeIfHasTeam", + Code = "PS:> Get-Microsoft365Group -IncludeIfHasTeam", Remarks = "Retrieves all the Microsoft 365 Groups and checks for each of them if it has a Microsoft Team provisioned for it", SortOrder = 6)] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_Read_All | MicrosoftGraphApiPermission.Group_ReadWrite_All | MicrosoftGraphApiPermission.GroupMember_ReadWrite_All | MicrosoftGraphApiPermission.GroupMember_Read_All | MicrosoftGraphApiPermission.Directory_ReadWrite_All | MicrosoftGraphApiPermission.Directory_Read_All)] - public class GetUnifiedGroup : PnPGraphCmdlet + public class GetMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = false, HelpMessage = "The Identity of the Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; [Parameter(Mandatory = false, HelpMessage = "Exclude fetching the site URL for Microsoft 365 Groups. This speeds up large listings.")] public SwitchParameter ExcludeSiteUrl; diff --git a/Commands/Graph/GetUnifiedGroupMembers.cs b/Commands/Graph/GetMicrosoft365GroupMembers.cs similarity index 85% rename from Commands/Graph/GetUnifiedGroupMembers.cs rename to Commands/Graph/GetMicrosoft365GroupMembers.cs index 358c02449..4f8ddc944 100644 --- a/Commands/Graph/GetUnifiedGroupMembers.cs +++ b/Commands/Graph/GetMicrosoft365GroupMembers.cs @@ -9,24 +9,25 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Get, "PnPUnifiedGroupMembers")] + [Cmdlet(VerbsCommon.Get, "PnPMicrosoft365GroupMembers")] + [Alias("Get-PnPUnifiedGroupMembers")] [CmdletHelp("Gets members of a particular Microsoft 365 Group (aka Unified Group). Requires the Azure Active Directory application permissions 'Group.Read.All' and 'User.Read.All'.", Category = CmdletHelpCategory.Graph, OutputTypeLink = "https://docs.microsoft.com/graph/api/group-list-members", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroupMembers -Identity $groupId", + Code = "PS:> Get-PnPMicrosoft365GroupMembers -Identity $groupId", Remarks = "Retrieves all the members of a specific Microsoft 365 Group based on its ID", SortOrder = 1)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroupMembers -Identity $group", + Code = "PS:> Get-PnPMicrosoft365GroupMembers -Identity $group", Remarks = "Retrieves all the members of a specific Microsoft 365 Group based on the group's object instance", SortOrder = 2)] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Directory_ReadWrite_All | MicrosoftGraphApiPermission.Directory_Read_All | MicrosoftGraphApiPermission.GroupMember_Read_All | MicrosoftGraphApiPermission.GroupMember_ReadWrite_All | MicrosoftGraphApiPermission.User_Read_All | MicrosoftGraphApiPermission.User_ReadWrite_All | MicrosoftGraphApiPermission.Group_Read_All | MicrosoftGraphApiPermission.Group_ReadWrite_All)] - public class GetUnifiedGroupMembers : PnPGraphCmdlet + public class GetMicrosoft365GroupMembers : PnPGraphCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; protected override void ExecuteCmdlet() { diff --git a/Commands/Graph/GetUnifiedGroupOwners.cs b/Commands/Graph/GetMicrosoft365GroupOwners.cs similarity index 78% rename from Commands/Graph/GetUnifiedGroupOwners.cs rename to Commands/Graph/GetMicrosoft365GroupOwners.cs index 4a3a36718..d742f6eac 100644 --- a/Commands/Graph/GetUnifiedGroupOwners.cs +++ b/Commands/Graph/GetMicrosoft365GroupOwners.cs @@ -9,24 +9,25 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Get, "PnPUnifiedGroupOwners")] - [CmdletHelp("Gets owners of a particular Microsoft 365 Group (aka Unified Group). Requires the Azure Active Directory application permissions 'Group.Read.All' and 'User.Read.All'.", + [Cmdlet(VerbsCommon.Get, "PnPMicrosoft365GroupOwners")] + [Alias("Get-PnPUnifiedGroupOwners")] + [CmdletHelp("Gets owners of a particular Microsoft 365 Group", Category = CmdletHelpCategory.Graph, OutputTypeLink = "https://docs.microsoft.com/graph/api/group-list-owners", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroupOwners -Identity $groupId", + Code = "PS:> Get-PnPMicrosoft365GroupOwners -Identity $groupId", Remarks = "Retrieves all the owners of a specific Microsoft 365 Group based on its ID", SortOrder = 1)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroupOwners -Identity $group", + Code = "PS:> Get-PnPMicrosoft365GroupOwners -Identity $group", Remarks = "Retrieves all the owners of a specific Microsoft 365 Group based on the group's object instance", SortOrder = 2)] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_Read_All | MicrosoftGraphApiPermission.User_Read_All | MicrosoftGraphApiPermission.Group_ReadWrite_All | MicrosoftGraphApiPermission.User_ReadWrite_All)] - public class GetUnifiedGroupOwners : PnPGraphCmdlet + public class GetMicrosoft365GroupOwners : PnPGraphCmdlet { - [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the Microsoft 365 Group.")] + public Microsoft365GroupPipeBind Identity; protected override void ExecuteCmdlet() { diff --git a/Commands/Graph/NewUnifiedGroup.cs b/Commands/Graph/NewMicrosoft365Group.cs similarity index 81% rename from Commands/Graph/NewUnifiedGroup.cs rename to Commands/Graph/NewMicrosoft365Group.cs index 523a84ae6..17521f1db 100644 --- a/Commands/Graph/NewUnifiedGroup.cs +++ b/Commands/Graph/NewMicrosoft365Group.cs @@ -9,29 +9,30 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.New, "PnPUnifiedGroup")] - [CmdletHelp("Creates a new Microsoft 365 Group (aka Unified Group). Requires the Azure Active Directory application permission 'Group.ReadWrite.All'.", + [Cmdlet(VerbsCommon.New, "PnPMicrosoft365Group")] + [Alias("New-PnPUnifiedGroup")] + [CmdletHelp("Creates a new Microsoft 365 Group", Category = CmdletHelpCategory.Graph, - OutputTypeLink = "https://docs.microsoft.com/graph/api/group-post-groups", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> New-PnPUnifiedGroup -DisplayName $displayName -Description $description -MailNickname $nickname", + Code = "PS:> New-PnPMicrosoft365Group -DisplayName $displayName -Description $description -MailNickname $nickname", Remarks = "Creates a public Microsoft 365 Group with all the required properties", SortOrder = 1)] [CmdletExample( - Code = "PS:> New-PnPUnifiedGroup -DisplayName $displayName -Description $description -MailNickname $nickname -Owners $arrayOfOwners -Members $arrayOfMembers", + Code = "PS:> New-PnPMicrosoft365Group -DisplayName $displayName -Description $description -MailNickname $nickname -Owners $arrayOfOwners -Members $arrayOfMembers", Remarks = "Creates a public Microsoft 365 Group with all the required properties, and with a custom list of Owners and a custom list of Members", SortOrder = 2)] [CmdletExample( - Code = "PS:> New-PnPUnifiedGroup -DisplayName $displayName -Description $description -MailNickname $nickname -IsPrivate", + Code = "PS:> New-PnPMicrosoft365Group -DisplayName $displayName -Description $description -MailNickname $nickname -IsPrivate", Remarks = "Creates a private Microsoft 365 Group with all the required properties", SortOrder = 3)] [CmdletExample( - Code = "PS:> New-PnPUnifiedGroup -DisplayName $displayName -Description $description -MailNickname $nickname -Owners $arrayOfOwners -Members $arrayOfMembers -IsPrivate", + Code = "PS:> New-PnPMicrosoft365Group -DisplayName $displayName -Description $description -MailNickname $nickname -Owners $arrayOfOwners -Members $arrayOfMembers -IsPrivate", Remarks = "Creates a private Microsoft 365 Group with all the required properties, and with a custom list of Owners and a custom list of Members", SortOrder = 4)] + [CmdletRelatedLink(Text = "Documentation", Url = "https://docs.microsoft.com/graph/api/group-post-groups")] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_Create | MicrosoftGraphApiPermission.Group_ReadWrite_All | MicrosoftGraphApiPermission.Directory_ReadWrite_All)] - public class NewPnPUnifiedGroup : PnPGraphCmdlet + public class NewPnPMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = true, HelpMessage = "The Display Name of the Microsoft 365 Group")] public String DisplayName; diff --git a/Commands/Graph/RemoveDeletedUnifiedGroup.cs b/Commands/Graph/RemoveDeletedMicrosoft365Group.cs similarity index 71% rename from Commands/Graph/RemoveDeletedUnifiedGroup.cs rename to Commands/Graph/RemoveDeletedMicrosoft365Group.cs index b5caf3e96..63d93eafc 100644 --- a/Commands/Graph/RemoveDeletedUnifiedGroup.cs +++ b/Commands/Graph/RemoveDeletedMicrosoft365Group.cs @@ -7,25 +7,25 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Remove, "PnPDeletedUnifiedGroup")] - - [CmdletHelp("Permanently removes one deleted Microsoft 365 Group (aka Unified Group)", + [Cmdlet(VerbsCommon.Remove, "PnPDeletedMicrosoft365Group")] + [Alias("Remove-PnPDeletedUnifiedGroup")] + [CmdletHelp("Permanently removes one deleted Microsoft 365 Group", Category = CmdletHelpCategory.Graph, SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Remove-PnPDeletedUnifiedGroup -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f", + Code = "PS:> Remove-PnPDeletedMicrosoft365Group -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f", Remarks = "Permanently removes a deleted Microsoft 365 Group based on its ID", SortOrder = 1)] [CmdletExample( - Code = @"PS:> $group = Get-PnPDeletedUnifiedGroup -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f -PS:> Remove-PnPDeletedUnifiedGroup -Identity $group", + Code = @"PS:> $group = Get-PnPDeletedMicrosoft365Group -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f +PS:> Remove-PnPDeletedMicrosoft365Group -Identity $group", Remarks = "Permanently removes the provided deleted Microsoft 365 Group", SortOrder = 2)] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_ReadWrite_All)] - public class RemoveDeletedUnifiedGroup : PnPGraphCmdlet + public class RemoveDeletedMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the deleted Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; protected override void ExecuteCmdlet() { diff --git a/Commands/Graph/RemoveUnifiedGroup.cs b/Commands/Graph/RemoveMicrosoft365Group.cs similarity index 74% rename from Commands/Graph/RemoveUnifiedGroup.cs rename to Commands/Graph/RemoveMicrosoft365Group.cs index f60722762..0d9305fbc 100644 --- a/Commands/Graph/RemoveUnifiedGroup.cs +++ b/Commands/Graph/RemoveMicrosoft365Group.cs @@ -8,28 +8,29 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Remove, "PnPUnifiedGroup")] - [CmdletHelp("Removes one Microsoft 365 Group (aka Unified Group)", + [Cmdlet(VerbsCommon.Remove, "PnPMicrosoft365Group")] + [Alias("Remove-PnPUnifiedGroup")] + [CmdletHelp("Removes one Microsoft 365 Group", Category = CmdletHelpCategory.Graph, OutputTypeLink = "https://docs.microsoft.com/graph/api/group-delete", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Remove-PnPUnifiedGroup -Identity $groupId", + Code = "PS:> Remove-PnPMicrosoft365Group -Identity $groupId", Remarks = "Removes an Microsoft 365 Group based on its ID", SortOrder = 1)] [CmdletExample( - Code = "PS:> Remove-PnPUnifiedGroup -Identity $group", + Code = "PS:> Remove-PnPMicrosoft365Group -Identity $group", Remarks = "Removes the provided Microsoft 365 Group", SortOrder = 2)] [CmdletExample( - Code = "PS:> Get-PnPUnifiedGroup | ? Visibility -eq \"Public\" | Remove-PnPUnifiedGroup", + Code = "PS:> Get-PnPMicrosoft365Group | ? Visibility -eq \"Public\" | Remove-PnPMicrosoft365Group", Remarks = "Removes all the public Microsoft 365 Groups", SortOrder = 3)] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_ReadWrite_All)] - public class RemoveUnifiedGroup : PnPGraphCmdlet + public class RemoveMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; protected override void ExecuteCmdlet() { diff --git a/Commands/Graph/ResetMicrosoft365GroupExpiration.cs b/Commands/Graph/ResetMicrosoft365GroupExpiration.cs new file mode 100644 index 000000000..c25b8fff2 --- /dev/null +++ b/Commands/Graph/ResetMicrosoft365GroupExpiration.cs @@ -0,0 +1,34 @@ +#if !ONPREMISES && !NETSTANDARD2_1 +using OfficeDevPnP.Core.Framework.Graph; +using SharePointPnP.PowerShell.CmdletHelpAttributes; +using SharePointPnP.PowerShell.Commands.Base; +using SharePointPnP.PowerShell.Commands.Base.PipeBinds; +using System.Management.Automation; + +namespace SharePointPnP.PowerShell.Commands.Graph +{ + [Cmdlet(VerbsCommon.Reset, "PnPMicrosoft365GroupExpiration")] + [Alias("Reset-PnPUnifiedGroupExpiration")] + [CmdletHelp("Renews the Microsoft 365 Group by extending its expiration with the number of days defined in the group expiration policy set on the Azure Active Directory", + DetailedDescription = "Renews the Microsoft 365 Group by extending its expiration with the number of days defined in the group expiration policy set on the Azure Active Directory", + Category = CmdletHelpCategory.Graph, + SupportedPlatform = CmdletSupportedPlatform.Online)] + [CmdletExample( + Code = "PS:> Reset-PnPMicrosoft365GroupExpiration", + Remarks = "Renews the Microsoft 365 Group by extending its expiration with the number of days defined in the group expiration policy set on the Azure Active Directory", + SortOrder = 1)] + [CmdletRelatedLink(Text = "Documentation", Url = "https://docs.microsoft.com/graph/api/group-renew")] + [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Directory_ReadWrite_All | MicrosoftGraphApiPermission.Group_ReadWrite_All)] + public class ResetMicrosoft365GroupExpiration : PnPGraphCmdlet + { + [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the Microsoft 365 Group")] + public Microsoft365GroupPipeBind Identity; + + protected override void ExecuteCmdlet() + { + var group = Identity.GetGroup(AccessToken); + UnifiedGroupsUtility.RenewUnifiedGroup(group.GroupId, AccessToken); + } + } +} +#endif \ No newline at end of file diff --git a/Commands/Graph/ResetUnifiedGroupExpiration.cs b/Commands/Graph/ResetUnifiedGroupExpiration.cs deleted file mode 100644 index 9df4a3177..000000000 --- a/Commands/Graph/ResetUnifiedGroupExpiration.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !ONPREMISES && !NETSTANDARD2_1 -using OfficeDevPnP.Core.Framework.Graph; -using SharePointPnP.PowerShell.CmdletHelpAttributes; -using SharePointPnP.PowerShell.Commands.Base; -using SharePointPnP.PowerShell.Commands.Base.PipeBinds; -using System.Management.Automation; - -namespace SharePointPnP.PowerShell.Commands.Graph -{ - [Cmdlet(VerbsCommon.Reset, "PnPUnifiedGroupExpiration")] - [CmdletHelp("Renews the Office 365 Group by extending its expiration with the number of days defined in the group expiration policy set on the Azure Active Directory", - DetailedDescription = "Renews the Office 365 Group by extending its expiration with the number of days defined in the group expiration policy set on the Azure Active Directory", - Category = CmdletHelpCategory.Graph, - OutputTypeLink = "https://docs.microsoft.com/graph/api/group-renew", - SupportedPlatform = CmdletSupportedPlatform.Online)] - [CmdletExample( - Code = "PS:> Reset-PnPUnifiedGroupExpiration", - Remarks = "Renews the Office 365 Group by extending its expiration with the number of days defined in the group expiration policy set on the Azure Active Directory", - SortOrder = 1)] - [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Directory_ReadWrite_All | MicrosoftGraphApiPermission.Group_ReadWrite_All)] - public class ResetUnifiedGroupExpiration : PnPGraphCmdlet - { - [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the Office 365 Group")] - public UnifiedGroupPipeBind Identity; - - protected override void ExecuteCmdlet() - { - var group = Identity.GetGroup(AccessToken); - UnifiedGroupsUtility.RenewUnifiedGroup(group.GroupId, AccessToken); - } - } -} -#endif \ No newline at end of file diff --git a/Commands/Graph/RestoreDeletedUnifiedGroup.cs b/Commands/Graph/RestoreDeletedMicrosoft365Group.cs similarity index 62% rename from Commands/Graph/RestoreDeletedUnifiedGroup.cs rename to Commands/Graph/RestoreDeletedMicrosoft365Group.cs index 6d6da3eb3..80acd930c 100644 --- a/Commands/Graph/RestoreDeletedUnifiedGroup.cs +++ b/Commands/Graph/RestoreDeletedMicrosoft365Group.cs @@ -7,26 +7,26 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsData.Restore, "PnPDeletedUnifiedGroup")] - - [CmdletHelp("Restores one deleted Microsoft 365 Group (aka Unified Group)", + [Cmdlet(VerbsData.Restore, "PnPDeletedMicrosoft365Group")] + [Alias("Restore-PnPDeletedUnifiedGroup")] + [CmdletHelp("Restores one deleted Microsoft 365 Group", Category = CmdletHelpCategory.Graph, - OutputTypeLink = "https://docs.microsoft.com/graph/api/directory-deleteditems-restore", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = "PS:> Restore-PnPDeletedUnifiedGroup -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f", + Code = "PS:> Restore-PnPDeletedMicrosoft365Group -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f", Remarks = "Restores a deleted Microsoft 365 Group based on its ID", SortOrder = 1)] [CmdletExample( - Code = @"PS:> $group = Get-PnPDeletedUnifiedGroup -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f -PS:> Restore-PnPDeletedUnifiedGroup -Identity $group", + Code = @"PS:> $group = Get-PnPDeletedMicrosoft365Group -Identity 38b32e13-e900-4d95-b860-fb52bc07ca7f +PS:> Restore-PnPDeletedMicrosoft365Group -Identity $group", Remarks = "Restores the provided deleted Microsoft 365 Group", SortOrder = 2)] + [CmdletRelatedLink(Text = "Documentation", Url = "https://docs.microsoft.com/graph/api/directory-deleteditems-restore")] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_ReadWrite_All)] - public class RestoreDeletedUnifiedGroup : PnPGraphCmdlet + public class RestoreDeletedMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = true, ValueFromPipeline = true, HelpMessage = "The Identity of the deleted Microsoft 365 Group")] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; protected override void ExecuteCmdlet() { diff --git a/Commands/Graph/SetUnifiedGroup.cs b/Commands/Graph/SetMicrosoft365Group.cs similarity index 83% rename from Commands/Graph/SetUnifiedGroup.cs rename to Commands/Graph/SetMicrosoft365Group.cs index 16d894a18..f5885661b 100644 --- a/Commands/Graph/SetUnifiedGroup.cs +++ b/Commands/Graph/SetMicrosoft365Group.cs @@ -10,36 +10,37 @@ namespace SharePointPnP.PowerShell.Commands.Graph { - [Cmdlet(VerbsCommon.Set, "PnPUnifiedGroup")] - [CmdletHelp("Sets Microsoft 365 Group (aka Unified Group) properties", + [Cmdlet(VerbsCommon.Set, "PnPMicrosoft365Group")] + [Alias("Set-PnPUnifiedGroup")] + [CmdletHelp("Sets Microsoft 365 Group properties", Category = CmdletHelpCategory.Graph, - OutputTypeLink = "https://docs.microsoft.com/graph/api/group-update", SupportedPlatform = CmdletSupportedPlatform.Online)] [CmdletExample( - Code = @"PS:> Set-PnPUnifiedGroup -Identity $group -DisplayName ""My Displayname""", + Code = @"PS:> Set-PnPMicrosoft365Group -Identity $group -DisplayName ""My Displayname""", Remarks = "Sets the display name of the group where $group is a Group entity", SortOrder = 1)] [CmdletExample( - Code = @"PS:> Set-PnPUnifiedGroup -Identity $groupId -Descriptions ""My Description"" -DisplayName ""My DisplayName""", + Code = @"PS:> Set-PnPMicrosoft365Group -Identity $groupId -Descriptions ""My Description"" -DisplayName ""My DisplayName""", Remarks = "Sets the display name and description of a group based upon its ID", SortOrder = 2)] [CmdletExample( - Code = @"PS:> Set-PnPUnifiedGroup -Identity $group -GroupLogoPath "".\MyLogo.png""", + Code = @"PS:> Set-PnPMicrosoft365Group -Identity $group -GroupLogoPath "".\MyLogo.png""", Remarks = "Sets a specific Microsoft 365 Group logo", SortOrder = 3)] [CmdletExample( - Code = @"PS:> Set-PnPUnifiedGroup -Identity $group -IsPrivate:$false", + Code = @"PS:> Set-PnPMicrosoft365Group -Identity $group -IsPrivate:$false", Remarks = "Sets a group to be Public if previously Private", SortOrder = 4)] [CmdletExample( - Code = @"PS:> Set-PnPUnifiedGroup -Identity $group -Owners demo@contoso.com", + Code = @"PS:> Set-PnPMicrosoft365Group -Identity $group -Owners demo@contoso.com", Remarks = "Sets demo@contoso.com as owner of the group", SortOrder = 5)] + [CmdletRelatedLink(Text = "Documentation", Url = "https://docs.microsoft.com/graph/api/group-update")] [CmdletMicrosoftGraphApiPermission(MicrosoftGraphApiPermission.Group_ReadWrite_All)] - public class SetUnifiedGroup : PnPGraphCmdlet + public class SetMicrosoft365Group : PnPGraphCmdlet { [Parameter(Mandatory = true, HelpMessage = "The Identity of the Microsoft 365 Group", ValueFromPipeline = true)] - public UnifiedGroupPipeBind Identity; + public Microsoft365GroupPipeBind Identity; [Parameter(Mandatory = false, HelpMessage = "The DisplayName of the group to set")] public string DisplayName; diff --git a/Commands/SharePointPnP.PowerShell.Commands.csproj b/Commands/SharePointPnP.PowerShell.Commands.csproj index 443be307d..a18b6231f 100644 --- a/Commands/SharePointPnP.PowerShell.Commands.csproj +++ b/Commands/SharePointPnP.PowerShell.Commands.csproj @@ -675,15 +675,14 @@ - - + - + - + - + @@ -849,19 +848,19 @@ - - + + - + - - + + Code @@ -874,7 +873,7 @@ - + @@ -902,7 +901,7 @@ - + diff --git a/Tests/OriginalTests/GraphTests.cs b/Tests/OriginalTests/GraphTests.cs index aae6275ed..3ccb6e23c 100644 --- a/Tests/OriginalTests/GraphTests.cs +++ b/Tests/OriginalTests/GraphTests.cs @@ -16,14 +16,14 @@ public void Initialize() { var random = new Random(); - var group = scope.ExecuteCommand("New-PnPUnifiedGroup", - new CommandParameter("DisplayName", "PnPDeletedUnifiedGroup test"), - new CommandParameter("Description", "PnPDeletedUnifiedGroup test"), + var group = scope.ExecuteCommand("New-PnPMicrosoft365Group", + new CommandParameter("DisplayName", "PnPDeletedMicrosoft365Group test"), + new CommandParameter("Description", "PnPDeletedMicrosoft365Group test"), new CommandParameter("MailNickname", $"pnp-unit-test-{random.Next(1, 1000)}"), new CommandParameter("Force")); _groupId = group[0].Properties["GroupId"].Value.ToString(); - scope.ExecuteCommand("Remove-PnPUnifiedGroup", new CommandParameter("Identity", _groupId)); + scope.ExecuteCommand("Remove-PnPMicrosoft365Group", new CommandParameter("Identity", _groupId)); } } @@ -34,7 +34,7 @@ public void Cleanup() { try { - scope.ExecuteCommand("Remove-PnPUnifiedGroup", new CommandParameter("Identity", _groupId)); + scope.ExecuteCommand("Remove-PnPMicrosoft365Group", new CommandParameter("Identity", _groupId)); } catch (Exception) { @@ -42,7 +42,7 @@ public void Cleanup() } try { - scope.ExecuteCommand("Remove-PnPDeletedUnifiedGroup", new CommandParameter("Identity", _groupId)); + scope.ExecuteCommand("Remove-PnPDeletedMicrosoft365Group", new CommandParameter("Identity", _groupId)); } catch (Exception) { @@ -52,49 +52,49 @@ public void Cleanup() } [TestMethod] - public void GetDeletedUnifiedGroups() + public void GetDeletedMicrosoft365Groups() { using (var scope = new PSTestScope()) { - var results = scope.ExecuteCommand("Get-PnPDeletedUnifiedGroup"); + var results = scope.ExecuteCommand("Get-PnPDeletedMicrosoft365Group"); Assert.IsTrue(results.Count > 0); } } [TestMethod] - public void GetDeletedUnifiedGroup() + public void GetDeletedMicrosoft365Group() { using (var scope = new PSTestScope()) { - var results = scope.ExecuteCommand("Get-PnPDeletedUnifiedGroup", new CommandParameter("Identity", _groupId)); + var results = scope.ExecuteCommand("Get-PnPDeletedMicrosoft365Group", new CommandParameter("Identity", _groupId)); Assert.IsTrue(results != null && results[0].Properties["GroupId"].Value.ToString() == _groupId); } } [TestMethod] - public void RestoreDeletedUnifiedGroup() + public void RestoreDeletedMicrosoft365Group() { using (var scope = new PSTestScope()) { - scope.ExecuteCommand("Restore-PnPDeletedUnifiedGroup", new CommandParameter("Identity", _groupId)); - var results = scope.ExecuteCommand("Get-PnPUnifiedGroup", new CommandParameter("Identity", _groupId)); + scope.ExecuteCommand("Restore-PnPDeletedMicrosoft365Group", new CommandParameter("Identity", _groupId)); + var results = scope.ExecuteCommand("Get-PnPMicrosoft365Group", new CommandParameter("Identity", _groupId)); Assert.IsTrue(results != null && results[0].Properties["GroupId"].Value.ToString() == _groupId); } } [TestMethod] - public void RemoveDeletedUnifiedGroup() + public void RemoveDeletedMicrosoft365Group() { using (var scope = new PSTestScope()) { - scope.ExecuteCommand("Remove-PnPDeletedUnifiedGroup", new CommandParameter("Identity", _groupId)); + scope.ExecuteCommand("Remove-PnPDeletedMicrosoft365Group", new CommandParameter("Identity", _groupId)); // The group should no longer be found in deleted groups try { - var results = scope.ExecuteCommand("Get-PnPDeletedUnifiedGroup", new CommandParameter("Identity", _groupId)); + var results = scope.ExecuteCommand("Get-PnPDeletedMicrosoft365Group", new CommandParameter("Identity", _groupId)); Assert.IsFalse(results != null); } catch (Exception)