0

I want to be able to display my PnPJS code and make it show up within the Content Editor, but I am having trouble pulling the data in and displaying it.

Here is what I have so far:

1.)

I made a SharePoint list called O365RoadMap that automatically pulls new updates on Microsoft's Office 365 Roadmap and posts them within the list using Microsoft Flow. enter image description here

2.)

<div class="roadMap" id="roadMap"></div>

<script src="/siteassets/bootstrap3/js/jquery-1.8.3.min.js"></script>
<script src="/publiccdnlib/PnP-JS-Core/pnp.min.js"></script>
<script type="text/javascript" src="/publiccdnlib/es6-Promise/es6-promise.auto.js"></script>
<script type="text/javascript" src="/publiccdnlib/fetch/fetch.min.js"></script>
<script src="/publiccdnlib/slick/slick.min.js"></script>
<script src="/publiccdnlib/CommonJS/CommonJS.js"></script>
<script src="/publiccdnlib/knockout/knockout.js"></script>
<script src="/publiccdnlib/knockout/knockout.simpleGrid.3.0.js"></script>
<script src="/publiccdnlib/toastr/toastr.min.js"></script>
<script src="/publiccdnlib/dialog/open-sp-dialog.js"></script>
<!--END Scripts for O365-->

<script>

    $pnp.setup({
        baseUrl: "/TrainingResourceCenter/O365Training"
    });
                                    <!--document.getElementById("roadMap").innerHTML = JSON.stringify(result, null, 2)-->
    $pnp.sp.web.lists.getByTitle("O365RoadMap").items.get().then(function(z){
        console.log(z);
        var result = z.results.map(a => ({
            Title: `${a.Title}`,
            Description: `${a.Description}`,
            Link: `${a.Link}`
            })
        )
        console.log(result);
    })
</script>

3.)

My Results are pulling in nicely using the Console log:
enter image description here

4.)
enter image description here But for some reason, it's not displaying within the content editor and it's linked to the correct .txt file location, is there something that I am missing? All help would be appreciated.

1

Enable the Custom Script feature via SharePoint admin center > https://DOMAIN-admin.sharepoint.com/ > Settings > https://DOMAIN-admin.sharepoint.com/_layouts/15/online/TenantSettings.aspx

Custom Script > Allow users to run custom script on self-service created sites >It takes about 24 hours for the change to take effect.

If the issue persists, follow the steps below to enable publishing feature : A. Go to Site Settings > Site Collection Administration > Site Collection Features >

https://DOMAIN.sharepoint.com/_layouts/15/ManageFeatures.aspx?Scope=Site > SharePoint Publishing Infrastructure > Activate. B. Go to Site Settings > https://DOMAIN.sharepoint.com/_layouts/15/ManageFeatures.aspx Site Actions > Manage site features > SharePoint Server Publishing > Activate.

If you do not want to wait for 24 hours, then use this powershell command :


$adminUPN="USERID@DOMAIN.onmicrosoft.com" $orgName="DOMAIN" $userCredential = Get-Credential -UserName $adminUPN -Message "Enter password" Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential

Set-SPOsite https://DOMAIN.sharepoint.com -DenyAddAndCustomizePages 0


please replace DOMAIN in URL with your domain, before clicking on link.

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.