protected override void ExecuteCmdlet() { // Following code to handle deprecated parameter CustomActionScope setScope; if (ParameterSpecified(nameof(SiteScoped))) { setScope = CustomActionScope.Site; } else { setScope = Scope; } if (setScope != CustomActionScope.All) { if (setScope == CustomActionScope.Web) { SelectedWeb.AddJsBlock(Name, Script, Sequence); } else { var site = ClientContext.Site; site.AddJsBlock(Name, Script, Sequence); } } else { ThrowTerminatingError(new ErrorRecord(new Exception("Scope parameter can only be set to Web or Site"), "INCORRECTVALUE", ErrorCategory.InvalidArgument, this)); } }
protected override void ExecuteCmdlet() { if (!SiteScoped) { SelectedWeb.AddJsBlock(Key, Script); } else { var site = ClientContext.Site; site.AddJsBlock(Key, Script); } }
protected override void ExecuteCmdlet() { if (Scope != CustomActionScope.All) { if (Scope == CustomActionScope.Web) { SelectedWeb.AddJsBlock(Name, Script, Sequence); } else { var site = ClientContext.Site; site.AddJsBlock(Name, Script, Sequence); } } else { ThrowTerminatingError(new ErrorRecord(new Exception("Scope parameter can only be set to Web or Site"), "INCORRECTVALUE", ErrorCategory.InvalidArgument, this)); } }
protected override void ExecuteCmdlet() { // Following code to handle desprecated parameter CustomActionScope setScope; if (MyInvocation.BoundParameters.ContainsKey("SiteScoped")) { setScope = CustomActionScope.Site; } else { setScope = Scope; } if (setScope == CustomActionScope.Web) { SelectedWeb.AddJsBlock(Name, Script, Sequence); } else { var site = ClientContext.Site; site.AddJsBlock(Name, Script, Sequence); } }
protected override void ExecuteCmdlet() { SelectedWeb.AddJsBlock(Key, Script); }