Delete SharePoint Column using PNP JS

Fields allow you to store typed information within a SharePoint list. There are many types of fields and the library seeks to simplify working with the most common types. Fields exist in both site collections (site columns) or lists (list columns) and you can add/modify/delete them at either of these levels.

Below snippet will help you to delete SharePoint Field using pop js core

<script type="text/javascript" src="/siteassets/scripts/fetch.js"></script> 
<script type="text/javascript" src="/siteassets/scripts/es6-promise.js"></script> 
<script type="text/javascript" src="/siteassets/scripts/pnp.min.js"></script>


<div id="sample"></div>


<script type=“text/javascript">

$pnp.sp.web.fields.getByTitle(“MyField4”).delete().then(f => {

   console.log(f);
});

</script>

Post a Comment

0 Comments