예제 #1
0
        protected override void ExecuteCmdlet()
        {
            if (ParameterSetName == ParameterSet_REMOVEALLNODES)
            {
#pragma warning disable CS0618 // Type or member is obsolete
                if (Force || ShouldContinue(string.Format(Resources.RemoveNavigationNodeInLocation, Location), Resources.Confirm))
                {
                    CurrentWeb.DeleteAllNavigationNodes(Location);
                }
#pragma warning restore CS0618 // Type or member is obsolete
            }
            else
            {
                if (Force || ShouldContinue("Remove node?", Resources.Confirm))
                {
                    if (ParameterSetName == ParameterSet_BYID)
                    {
                        var node = CurrentWeb.Navigation.GetNodeById(Identity.Id);
                        node.DeleteObject();
                        ClientContext.ExecuteQueryRetry();
                    }
                    else
                    {
#pragma warning disable CS0618 // Type or member is obsolete
                        CurrentWeb.DeleteNavigationNode(Title, Header, Location);
#pragma warning restore CS0618 // Type or member is obsolete
                    }
                }
            }
        }