protected override void ExecuteCmdlet()
        {
            if (WebAction == null && ListAction == null && ListItemAction == null && PostWebAction == null && PostListAction == null)
            {
                WriteError(new ErrorRecord(new ArgumentNullException("An action need to be specified"), "0", ErrorCategory.InvalidArgument, null));
                return;
            }

            InvokeActionParameter<web> webActions = new InvokeActionParameter<web>()
            {
                Action = WebAction,
                ShouldProcessAction = ShouldProcessWebAction,
                PostAction = PostWebAction,
                ShouldProcessPostAction = ShouldProcessPostWebAction,
                Properties = WebProperties
            };

            InvokeActionParameter<List> listActions = new InvokeActionParameter<List>()
            {
                Action = ListAction,
                ShouldProcessAction = ShouldProcessListAction,
                PostAction = PostListAction,
                ShouldProcessPostAction = ShouldProcessPostListAction,
                Properties = ListProperties
            };

            InvokeActionParameter<ListItem> listItemActions = new InvokeActionParameter<ListItem>()
            {
                Action = ListItemAction,
                ShouldProcessAction = ShouldProcessListItemAction,
                Properties = WebProperties
            };

            InvokeAction.InvokeWebAction invokeAction;
            if (string.IsNullOrEmpty(ListName))
            {
                IEnumerable<web> websToProcess;
                if (Webs == null || Webs.Length == 0)
                    websToProcess = new[] { SelectedWeb };
                else
                    websToProcess = Webs;

                invokeAction = new InvokeAction.InvokeWebAction(this, websToProcess, SubWebs.ToBool(), webActions, listActions, listItemActions, SkipCounting.ToBool());
            }
            else
            {
                invokeAction = new InvokeAction.InvokeWebAction(this, SelectedWeb, ListName, webActions, listActions, listItemActions, SkipCounting.ToBool());
            }

            InvokeWebActionResult result = invokeAction.StartProcessAction();

            if (!DisableStatisticsOutput)
            {
                WriteObject(result.ToDataTable());
            }

            WriteObject(result);
        }
Exemple #2
0
        protected override void ExecuteCmdlet()
        {
            if (WebAction == null && ListAction == null && ListItemAction == null && PostWebAction == null && PostListAction == null)
            {
                ThrowTerminatingError(new ErrorRecord(new ArgumentNullException("An action need to be specified"), "0", ErrorCategory.InvalidArgument, null));
                return;
            }

            InvokeActionParameter <web> webActions = new InvokeActionParameter <web>()
            {
                Action = WebAction,
                ShouldProcessAction     = ShouldProcessWebAction,
                PostAction              = PostWebAction,
                ShouldProcessPostAction = ShouldProcessPostWebAction,
                Properties              = WebProperties
            };

            InvokeActionParameter <List> listActions = new InvokeActionParameter <List>()
            {
                Action = ListAction,
                ShouldProcessAction     = ShouldProcessListAction,
                PostAction              = PostListAction,
                ShouldProcessPostAction = ShouldProcessPostListAction,
                Properties              = ListProperties
            };

            InvokeActionParameter <ListItem> listItemActions = new InvokeActionParameter <ListItem>()
            {
                Action = ListItemAction,
                ShouldProcessAction = ShouldProcessListItemAction,
                Properties          = WebProperties
            };

            InvokeAction.InvokeWebAction invokeAction;
            if (string.IsNullOrEmpty(ListName))
            {
                IEnumerable <web> websToProcess;
                if (Webs == null || Webs.Length == 0)
                {
                    websToProcess = new[] { SelectedWeb }
                }
                ;
                else
                {
                    websToProcess = Webs;
                }

                invokeAction = new InvokeAction.InvokeWebAction(this, websToProcess, SubWebs.ToBool(), webActions, listActions, listItemActions, SkipCounting.ToBool());
            }
            else
            {
                invokeAction = new InvokeAction.InvokeWebAction(this, SelectedWeb, ListName, webActions, listActions, listItemActions, SkipCounting.ToBool());
            }

            InvokeWebActionResult result = invokeAction.StartProcessAction();

            if (!DisableStatisticsOutput)
            {
                WriteObject(result.ToDataTable());
            }

            WriteObject(result);
        }