Closed Gennady-G closed 7 years ago
Oh, my mistake. Closed.
I used get_web() instead of get_site()..
Used this code to remove broken scriplinks, thanks to Vadim Gremyachev post http://sharepoint.stackexchange.com/questions/164745/unable-to-unregister-usercustomactions-added-at-location-scriptlink-using-csom:
function deleteCustomActionById(sequenceNo) {
var siteColUrl = jQuery("#inputsitecollectionurl").val();
var sequenceNumToDelete = parseInt(sequenceNo, 10);
var ctx = new SP.ClientContext(siteColUrl);
var site = ctx.get_site();
ctx.load(site);
var userCustomActions = site.get_userCustomActions();
ctx.load(userCustomActions);
ctx.executeQueryAsync(onSuccessGetCustomAction, onErrorGetCustomAction);
function onSuccessGetCustomAction() {
var result = userCustomActions.get_data().filter(function (a) {
var seqNumber = a.get_sequence();
if (a.get_sequence() === sequenceNumToDelete)
return a;
});
console.log(result);
Write("Deleting Custom Actions with selected sequence..");
if (result.length > 0) {
result[0].deleteObject();
ctx.executeQueryAsync(onSuccessDeleteCustomAction, onErroronDeleteCustomAction);
}
// ..
}
Hi, so you created scriptlink that broke your sitecollection? And you could not remove it from SP Editor extension?
Hi, so you created scriptlink that broke your sitecollection?
Hi! Yes, I got an exception on all site pages and empty screen on Application pages.
And you could not remove it from SP Editor extension?
Yes, I didn't find how to remove it. Maybe I have not read documentation carefully and You allow to do it, I haven't realized..
I used code to remove it, now problem is resolved
Ok, good. The problem occurs when the MakeBrowserCacheSafeLayoutsUrl fails, then the entire page is broken. If the customaction scope was sitecollection, then the entire sitecollection will get this error. Chrome SP Editor needs _spPageContextInfo from the page and when this error ocurrs, the info in not in the page and it cannot remove the broken customaction. Maybe I could add validation of the url when adding the scriptlink. Will close this for now. Thanks for reporting!
Hi tavikukko! Good idea! And thank You too! :)
Best regards,
Gennady
Hi!
Maybe I have done something wrong, but it breaks my test site collection page
I used ~sitecollection alias and a space in "style library", maybe it is the mistake. However - how can I revert this change? I don't see this string neither in SPD seattle.master nor in Home.aspx
SP2013 with last CU(15.0.4875.1000), (maybe Publishing Features are On, cannot check now)
Tried to view all installed userCustomActions but see nothing (I drop this in CEWP on other site collection):
Best regards, Gennady