protected override void ExecuteCmdlet() { var actions = new List <UserCustomAction>(); if (Scope == CustomActionScope.All || Scope == CustomActionScope.Web) { actions.AddRange(CurrentWeb.GetCustomActions().Where(c => c.Location == "ScriptLink")); } if (Scope == CustomActionScope.All || Scope == CustomActionScope.Site) { actions.AddRange(ClientContext.Site.GetCustomActions().Where(c => c.Location == "ScriptLink")); } if (!string.IsNullOrEmpty(Name)) { var foundAction = actions.FirstOrDefault(x => x.Name == Name); if (foundAction != null || !ThrowExceptionIfJavaScriptLinkNotFound) { WriteObject(foundAction, true); } else { throw new PSArgumentException($"No JavaScriptLink found with the name '{Name}' within the scope '{Scope}'", "Name"); } } else { WriteObject(actions, true); } }
protected override void ExecuteCmdlet() { List <UserCustomAction> actions = new List <UserCustomAction>(); if (Scope == CustomActionScope.All || Scope == CustomActionScope.Web) { actions.AddRange(CurrentWeb.GetCustomActions(RetrievalExpressions)); } if (Scope == CustomActionScope.All || Scope == CustomActionScope.Site) { actions.AddRange(ClientContext.Site.GetCustomActions(RetrievalExpressions)); } if (Identity != Guid.Empty) { var foundAction = actions.FirstOrDefault(x => x.Id == Identity); if (foundAction != null || !ThrowExceptionIfCustomActionNotFound) { WriteObject(foundAction, true); } else { throw new PSArgumentException($"No CustomAction found with the Identity '{Identity}' within the scope '{Scope}'", "Identity"); } } else { WriteObject(actions, true); } }
protected override void ExecuteCmdlet() { List <UserCustomAction> actions = new List <UserCustomAction>(); if (Scope == CustomActionScope.All || Scope == CustomActionScope.Web) { actions.AddRange(CurrentWeb.GetCustomActions(RetrievalExpressions)); } if (Scope == CustomActionScope.All || Scope == CustomActionScope.Site) { actions.AddRange(ClientContext.Site.GetCustomActions(RetrievalExpressions)); } if (Identity != Guid.Empty) { var foundAction = actions.FirstOrDefault(x => x.Id == Identity && x.Location == "ClientSideExtension.ApplicationCustomizer"); if (foundAction != null || !ThrowExceptionIfCustomActionNotFound) { WriteObject(foundAction, true); } else { throw new PSArgumentException($"No SharePoint Framework client side extension application customizer found with the Identity '{Identity}' within the scope '{Scope}'", "Identity"); } } else { switch (ParameterSetName) { case ParameterSet_CLIENTSIDECOMPONENTID: actions = actions.Where(x => x.Location == "ClientSideExtension.ApplicationCustomizer" & x.ClientSideComponentId == ClientSideComponentId).ToList(); break; case ParameterSet_CUSTOMACTIONID: actions = actions.Where(x => x.Location == "ClientSideExtension.ApplicationCustomizer").ToList(); break; } WriteObject(actions, true); } }