/// <summary> /// </summary> private void bgw_LoadActions(object sender, DoWorkEventArgs e) { var lstUserActionObjs = new List <UserActionObject>(); try { var targetSite = new Uri(tbSiteUrl.Text.Trim()); using (ClientContext ctx = new ClientContext(targetSite)) { ctx.Credentials = BuildCreds(); FixCtxForMixedMode(ctx); Site site = ctx.Site; ctx.Load(site, x => x.ServerRelativeUrl); ctx.ExecuteQuery(); tcout("Site loaded", site.ServerRelativeUrl); UserCustomActionCollection spActions = null; if (scope.IsEqual("Site Collection")) { spActions = ctx.Site.UserCustomActions; } else { spActions = ctx.Web.UserCustomActions; } ctx.Load(spActions); ctx.ExecuteQuery(); tcout("UserCustomActions Count", spActions.Count); var spActionsSorted = spActions.ToList <UserCustomAction>().OrderBy(x => x.Sequence).ThenBy(x => x.Name); foreach (UserCustomAction spAction in spActionsSorted) { var userActionObj = new BandR.UserActionObject(); userActionObj.id = spAction.Id.ToString(); userActionObj.name = spAction.Name; userActionObj.descr = spAction.Description; userActionObj.seq = spAction.Sequence; userActionObj.scriptBlock = spAction.ScriptBlock; userActionObj.scriptSrc = spAction.ScriptSrc; lstUserActionObjs.Add(userActionObj); tcout("-----------------------------"); tcout("Found UserCustomAction:"); tcout(" - Id", spAction.Id.ToString()); tcout(" - Name", spAction.Name); tcout(" - Title", spAction.Title); tcout(" - CommandUIExtension", spAction.CommandUIExtension); tcout(" - Description", spAction.Description); tcout(" - Group", spAction.Group); tcout(" - ImageUrl", spAction.ImageUrl); tcout(" - Location", spAction.Location); tcout(" - RegistrationId", spAction.RegistrationId); tcout(" - RegistrationType", spAction.RegistrationType.ToString()); tcout(" - Scope", spAction.Scope.ToString()); tcout(" - ScriptBlock", spAction.ScriptBlock); tcout(" - ScriptSrc", spAction.ScriptSrc); tcout(" - Sequence", spAction.Sequence); tcout(" - Url", spAction.Url); } } } catch (Exception ex) { tcout(" *** ERROR", GetExcMsg(ex)); ErrorOccurred = true; } e.Result = new List <object>() { lstUserActionObjs }; }