protected override void ExecuteCmdlet()
        {
            if (Identity != null)
            {
                UnifiedGroupEntity group = Identity.GetGroup(AccessToken);

                if (group != null)
                {
                    UnifiedGroupsUtility.DeleteUnifiedGroup(group.GroupId, AccessToken);
                }
            }
        }
        public void Initialize()
        {
            _accessToken = TestCommon.AcquireTokenAsync("https://graph.microsoft.com");

            TestCommon.FixAssemblyResolving("Newtonsoft.Json");

            var random = new Random();

            _groupId = UnifiedGroupsUtility.CreateUnifiedGroup("PnPDeletedUnifiedGroup test", "PnPDeletedUnifiedGroup test", $"pnp-unit-test-{random.Next(1, 1000)}", _accessToken, groupLogo: null).GroupId;

            UnifiedGroupsUtility.DeleteUnifiedGroup(_groupId, _accessToken);
        }
 public void CleanUp()
 {
     try
     {
         UnifiedGroupsUtility.DeleteUnifiedGroup(_groupId, _accessToken);
     }
     catch (Exception)
     {
         // Group has already been deleted
     }
     try
     {
         UnifiedGroupsUtility.PermanentlyDeleteUnifiedGroup(_groupId, _accessToken);
     }
     catch (Exception)
     {
         // Group has already been permanently deleted
     }
 }
        protected override void ExecuteCmdlet()
        {
            if (Identity != null)
            {
                UnifiedGroupEntity group = null;

                // We have to retrieve a specific group
                if (Identity.Group != null)
                {
                    group = UnifiedGroupsUtility.GetUnifiedGroup(Identity.Group.GroupId, AccessToken);
                }
                else if (!String.IsNullOrEmpty(Identity.GroupId))
                {
                    group = UnifiedGroupsUtility.GetUnifiedGroup(Identity.GroupId, AccessToken);
                }

                if (group != null)
                {
                    UnifiedGroupsUtility.DeleteUnifiedGroup(group.GroupId, AccessToken);
                }
            }
        }