Display SharePoint List Data using Modern Script Editor

%3CLINGO-SUB%20id%3D%22lingo-sub-2381327%22%20slang%3D%22en-US%22%3EDisplay%20SharePoint%20List%20Data%20using%20Modern%20Script%20Editor%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2381327%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20we%20get%20the%20Online%20SharePoint%20List%26nbsp%3B%20Items%20and%20display%20in%20Modern%20Script%20Editor%20using%20Rest%20or%20JSOM.%3C%2FP%3E%3CP%3EBecause%20I%20am%20unable%20to%20run%20even%20a%20small%20below%20alert%20java%20script%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EClick%20the%20button%20to%20display%20an%20alert%20box.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBUTTON%20onclick%3D%22%26quot%3BmyFunction()%26quot%3B%22%3ETry%20it%3C%2FBUTTON%3E%3C%2FP%3E%3CP%3E%3CSCRIPT%3E%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3Bfunction%20myFunction()%20%7B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3Balert(%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bquot%3BHello!%20I%20am%20an%20alert%20box!%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bquot%3B)%3B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BBR%20%2F%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2381327%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2383632%22%20slang%3D%22en-US%22%3ERe%3A%20Display%20SharePoint%20List%20Data%20using%20Modern%20Script%20Editor%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2383632%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F61151%22%20target%3D%22_blank%22%3E%40siddiq%20ali%3C%2FA%3E%26nbsp%3BIf%20I%20understand%20your%20question%2C%20you%20are%20asking%20about%20the%20availability%20of%20the%20Script%20Editor%20Web%20Part%20(SEWP)%20or%20Content%20Editor%20Web%20Part%20(CEWP)%20in%20SharePoint%20Online.%20Both%20of%20these%20web%20parts%20allows%20content%20editors%20to%20inject%20javascript%20on%20the%20page.%26nbsp%3B%20Microsoft%20intentionally%20has%20not%20ported%20either%20of%20those%20web%20parts%20into%20SharePoint%20Online%20with%20the%20reason%20being%20the%20multitude%20of%20issues%20this%20type%20of%20code%20can%20cause%2C%20including%20security%20issues.%20To%20my%20knowledge%2C%20they%20have%20not%20plan%20to%20change%20thier%20position.%3C%2FP%3E%0A%3CP%3EThe%20approved%20solution%20is%20to%20create%20a%20SharePoint%20Framework%20(SPFx)%20webpart%20to%20run%20the%20code.%20While%20there%20is%20a%20learning%20curce%20to%20SPFx%2C%20the%20result%20is%20code%20that%20is%20safer%20and%20ensures%20admin%20oversight%20(capability.)%20IF%20you%20have%20code%20that%20is%20already%20running%20in%20a%20SEWP%2C%20putting%20that%20into%20SPFx%20should%20not%20be%20too%20difficult.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20answers%20your%20question.%20If%20so%2C%20please%20mark%20my%20response%20as%20the%20approved%20answer.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello All,

 

Can we get the Online SharePoint List  Items and display in Modern Script Editor using Rest or JSOM.

Because I am unable to run even a small below alert java script

 

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display an alert box.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
alert("Hello! I am an alert box!");
}
</script>

</body>
</html>

1 Reply

@siddiq ali If I understand your question, you are asking about the availability of the Script Editor Web Part (SEWP) or Content Editor Web Part (CEWP) in SharePoint Online. Both of these web parts allows content editors to inject javascript on the page.  Microsoft intentionally has not ported either of those web parts into SharePoint Online with the reason being the multitude of issues this type of code can cause, including security issues. To my knowledge, they have not plan to change thier position.

The approved solution is to create a SharePoint Framework (SPFx) webpart to run the code. While there is a learning curce to SPFx, the result is code that is safer and ensures admin oversight (capability.) IF you have code that is already running in a SEWP, putting that into SPFx should not be too difficult.

 

I hope this answers your question. If so, please mark my response as the approved answer. Thanks.