Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2771 from KoenZomers/RenameUnifiedGroupToMicrosof…
Browse files Browse the repository at this point in the history
…t365Group

Renamed UnifiedGroup cmdlets to Microsoft365Group
  • Loading branch information
erwinvanhunen authored Jul 8, 2020
2 parents b3abf8d + 17712e3 commit bff60a9
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 136 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
34 changes: 34 additions & 0 deletions Commands/Graph/ResetMicrosoft365GroupExpiration.cs
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit bff60a9

Please sign in to comment.