1

I have 2 site collection A and B. I have a CEWP in site collection A and a document library in site coll B which contain a script in txt file. I want to copy the link of txt file from B and put it in CEWP in site coll A.

But its not working and giving below error. How I can resolve this? I do not want to move txt file in site coll A. Its o365.

error : Cannot retrieve the URL specified in the Content Link property. For more assistance, contact your site administrator.

2

I had no idea it was the problem in O365. In SharePoint on-premises it works just fine.

Update: I was wrong. CEWP does not work across site collections on-premises.

Maybe, as a workaround, this jQuery-based hacky solution will work for some cases. In your CEWP insert this content:

<div id="content"> </div> 

<script>
$(function(){
   $("#content").load( "/sites/SiteCollection/SiteAssets/app.html" );
})
</script>​

It does not feel like a great solution, but I hate the idea of copying the same files across multiple site collections.

  • 1
    SharePoint on-premises has the same issue. This behavior is "by design". – Christophe Dec 28 '17 at 21:30
0

You cannot use links across site collections in a CEWP. This is "by design".

I usually create one set of scripts per site collection. Yes, that means duplicates, but then each site collection admin can manage his/her own environment.

A workaround would be to store the JavaScript in a js file (resp. css in a css file), then call those files from your txt file in each site collection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.