{"id":582,"date":"2017-01-25T00:00:00","date_gmt":"2017-01-25T08:00:00","guid":{"rendered":"http:\/\/officedevblogs.wpengine.com\/?p=582"},"modified":"2021-11-15T11:27:30","modified_gmt":"2021-11-15T19:27:30","slug":"sharepoint-pnp-javascript-core-library-v20","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/sharepoint-pnp-javascript-core-library-v20\/","title":{"rendered":"SharePoint PnP JavaScript Core Library v2.0"},"content":{"rendered":"<div id=\"body-content\">\n<p><img decoding=\"async\" class=\"img-responsive\" width=\"800\" height=\"362\" alt=\"Banner with the blog title written on it\" src=\"https:\/\/officedevblogs.wpengine.com\/wp-content\/uploads\/2018\/05\/dev-office-com-js-core-200-1.png\"><\/p>\n<p>The&nbsp;<a href=\"https:\/\/github.com\/OfficeDev\/PnP-JS-Core\/\">SharePoint Patterns and Practices JavaScript Core Library<\/a>&nbsp;was created to help developers by simplifying common operations within SharePoint and the SharePoint Framework. This is open source, community driven library with contributions cross different organizations and teams. Currently it contains a fluent API for working with the full SharePoint REST API as well as utility and helper functions. This takes the guess work out of creating REST requests, letting developers focus on the what and less on the how. PnP JS Core library can be used&nbsp;in SharePoint Online or in on-premises. It&#8217;s a&nbsp;great library to be used with&nbsp;<a href=\"https:\/\/officedevblogs.wpengine.com\/dev.office.com\/sharepoint\/docs\/spfx\/sharepoint-framework-overview\">SharePoint Framework customizations<\/a>, but it can be also used using classic development models, like with Script Editor Web Part or&nbsp;when you embed JavaScript to SharePoint using User Custom Actions.<\/p>\n<p>The latest release, 2.0.0, of the&nbsp;<a href=\"https:\/\/github.com\/OfficeDev\/PnP-js-core\">Patterns and Practices JavaScript Core Library<\/a>&nbsp;represents an exciting milestone in library&nbsp;evolution and is thanks to all of the great contributions, feedback, and ideas from the community. Thank you all!&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"img-responsive\" width=\"600\" height=\"337\" alt=\"Git animation showing how the library works\" src=\"https:\/\/officedevblogs.wpengine.com\/wp-content\/uploads\/2018\/05\/pnp-js-core-animation-600-1.gif\"><\/p>\n<h2>Reorganization<\/h2>\n<p>If you are a contributor to the library, one of the first things you&rsquo;ve likely noticed in the dev branch is that we moved things around. We added a debug folder (more on that below) and removed provisioning code. The provisioning code can now be found in&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-provisioning\">a new repository<\/a>&nbsp;where it can grow and evolve on its own. We also reorganized and simplified the&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Gulp-Tasks\">gulp tasks<\/a>&nbsp;&ndash; though all of the expected functionality remains in place.<\/p>\n<h2>Debugging<\/h2>\n<p>Taking into account feedback and a desire to enhance the development experience we added support for debugging directly in the library. This will help with folks developing new features or fixing bugs as you can directly test, set break points, and step through the internals of the library. The full steps are&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Debugging\">outlined here<\/a>.<\/p>\n<h2>Wiki Enhancements<\/h2>\n<p>Another piece of feedback we heard is a need for better documentation and we have started to&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\">enhance the wiki<\/a>&nbsp;to include deeper details around configuring, using, and extending the library. We have reorganized the menu to help guide you to the information you need to be successful. As always these articles are a work in progress and the community is encouraged to help us create new articles or update existing ones.<\/p>\n<h2>Enhancements<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/971c157f32f0270bde611ef807bac7cfe5b03a4b\">Added<\/a>&nbsp;a getJSON method to File<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/d2e14998516384cc742a2b7871690db778f921c9\">Added<\/a>&nbsp;support for attachments on list items<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/3b7278eb90c83cea3576913c8db116d2b79ada8d\">Multiple<\/a><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/19f0cdc10102b2fc5b2608fcb9251bec42a9999a\">updates<\/a>&nbsp;to UserCustomActions<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/9cd3c033aade8f99e94686cb5418952d6ef62b29\">Simplified<\/a>&nbsp;request pipeline<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/51b9baa74a3f80226232a26a78e4e2d3193235cf\">Added<\/a>&nbsp;currentUser property to web<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/4b90ccab101abfce58a0b512e64c29b1c17bd760\">Added<\/a>&nbsp;custom exceptions<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/412aa62586ba2bedc2327d783a3913d8d6f75661\">Added<\/a>&nbsp;support for use of custom HttpClientImpl instances (<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Custom-HttpClientImpl\">docs<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/19445ef25fb3ca14bc8ff2efa30ccf515d223083\">Gave full control<\/a>&nbsp;of response handling including errors to parsers (<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Response-Parsers\">parser docs<\/a>)<\/li>\n<li>Exporting additional classes from the library<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/3155a9b826abc4640708884ce954b9b8cb99b159\">Added<\/a>&nbsp;limited FieldLinks support (as possible with the REST API)<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/b41e0f736b9f359b6009b5e18c9ccfc3113f1393\">Added<\/a>&nbsp;file property to item class<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/e0b90474ff134f8c0c7d08761da76b3a4d9ee718\">Added<\/a>&nbsp;ability to manage features in webs\/sites<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/eb96952668e6c6e8bb67aedf9b1ba5912f4cb292\">Ability<\/a>&nbsp;to pass&nbsp;ListItemEntityTypeFullName when creating list items (<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Working-With:-Items\">example<\/a>)\n<\/li>\n<\/ul>\n<h2>Bug Fixes<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/f95b83c686b9b8a37e94906ae520e223c05aeb7c\">Fix<\/a>&nbsp;for empty body in SPRequestExecutorClient<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/f39f7b86aa7b0502e19960166b9af63c830c91dd\">Fix<\/a>&nbsp;for broken tests<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/32d1d55ad319a4b13d6a8ebcc5739042b3b7cdcf\">Fix<\/a>&nbsp;for empty responses in SPRequestExecutorClient as reported in&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/issues\/256\">#256<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/5f7036a1de3b0b5bd64f1ac3170ecb1c87cb26d5\">Fix<\/a>&nbsp;for context info when a Site instance is created directly<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/fa08126ea3f2c3a0deb5c56200d8bc1d30c5bdb9\">Fix<\/a>&nbsp;for property names in wrong property names in sitegroups and siteusers<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/e4c7d7e13e43a142f5a57e4c5b5168cededd4094\">Fixed<\/a>&nbsp;bug with using a web immediately after it is created using ensure<\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/commit\/119125f7f1e43a8a034a43d4f59f3bed688e8586\">Fixed<\/a>&nbsp;typing errors when using library with SharePoint Framework<\/li>\n<\/ul>\n<p>This update does represent a&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Moving-from-1.0.*-to-2.0.0\">breaking change<\/a>&nbsp;but we&rsquo;ve tried to minimize the effort required in migration.<\/p>\n<h2>Additional resources around&nbsp;PnP JS Core Library<\/h2>\n<p>Here&nbsp;are some additional resources around the SharePoint Framework development topics<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\">PnP-JS-Core GitHub repository<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\">SharePoint Patterns and Practices JS Core Library Wiki<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/SharePoint\/PnP-JS-Core\/wiki\/Developer-Guide\">SharePoint Patterns and Practices JS Core &#8211; Developer Guide<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/sp-pnp-js\">sp-pnp-js at npmjs.com<\/a><\/li>\n<li><a href=\"https:\/\/sharepoint.github.io\/PnP-JS-Core\/\">sp-pnp-js API documentation\n<p> <\/a><\/li>\n<\/ul>\n<p>If you have any questions, comments or feedback around PnP initiative, these tutorials or this blog post, please use the&nbsp;<a href=\"https:\/\/techcommunity.microsoft.com\/t5\/SharePoint-Developer\/bd-p\/SharePointDev\">Microsoft Tech&nbsp;Community<\/a>&nbsp;(SharePoint Developer group) or the&nbsp;<a href=\"https:\/\/github.com\/SharePoint\/sp-dev-docs\/issues\">issue list<\/a>&nbsp;in the sp-dev-docs repository.<\/p>\n<p><span style=\"font-size: large\"><em>&ldquo;Sharing is caring&rdquo;<\/em><\/span><\/p>\n<hr>\n<p><i><a href=\"twitter.com\/mediocrebowler\">Patrick Rodgers<\/a>, Senior Program Manager, SharePoint, Microsoft &#8211; 25th of January 2017<\/i><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;SharePoint Patterns and Practices JavaScript Core Library&nbsp;was created to help developers by simplifying common operations within SharePoint and the SharePoint Framework. This is open source, community driven library with contributions cross different organizations and teams. Currently it contains a fluent API for working with the full SharePoint REST API as well as utility and helper [&hellip;]<\/p>\n","protected":false},"author":69078,"featured_media":583,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-582","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sharepoint-framework"],"acf":[],"blog_post_summary":"<p>The&nbsp;SharePoint Patterns and Practices JavaScript Core Library&nbsp;was created to help developers by simplifying common operations within SharePoint and the SharePoint Framework. This is open source, community driven library with contributions cross different organizations and teams. Currently it contains a fluent API for working with the full SharePoint REST API as well as utility and helper [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69078"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=582"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/582\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/583"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}