Aug 09 2016 04:34 AM
Oops..
Instead of pasting a plain text URL I managed to create a Site UserCuctomAction with HTML code in it.
This "script" is now executing on every page.
The result is an (Office365) SharePoint server that delivers me only blank pages.
Is there an easy method of resetting UserCustomActions?
Aug 09 2016 04:42 AM
Aug 09 2016 06:49 AM
Aug 17 2016 05:11 AM
I've made the same mistake doing some testing. To fix it I wrote a small console app to list the user custom actions and pick and choose to delete them. Maybe for future reference:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.SharePoint.Client; using System.Security; namespace SharePointCustomAction { class Program { static void Main(string[] args) { Console.WriteLine("Password:"); var password = GetConsoleSecurePassword(); Console.WriteLine(); using (var ctx = new ClientContext("https://tenant.sharepoint.com")) { ctx.Credentials = new SharePointOnlineCredentials("user@tenant.onmicrosoft.com", password); var uca = ctx.Web.UserCustomActions; ctx.Load(uca); ctx.ExecuteQuery(); for (var i = uca.Count - 1; i > -1; i--) { Console.WriteLine(string.Format("Delete embedded script: {0}", uca[i].Title)); var input = Console.ReadKey(); if (input.KeyChar == 'y') { uca[i].DeleteObject(); } Console.WriteLine(); } ctx.ExecuteQuery(); Console.WriteLine("-----Finished------"); Console.ReadLine(); } } private static SecureString GetConsoleSecurePassword() { SecureString pwd = new SecureString(); while (true) { ConsoleKeyInfo i = Console.ReadKey(true); if (i.Key == ConsoleKey.Enter) { break; } else if (i.Key == ConsoleKey.Backspace) { pwd.RemoveAt(pwd.Length - 1); Console.Write("\b \b"); } else { pwd.AppendChar(i.KeyChar); Console.Write("*"); } } return pwd; } } }
Aug 17 2016 08:52 AM
SolutionAug 17 2016 08:57 AM
Did you try the PnP PoSH?
Remove-SPOCustomAction -Scope Site
Aug 17 2016 11:00 AM
Some REST calls instead of JSOM did the job