0

I am just starting to try to figure out how to reference some external libraries using webpack.config.js. I need to reference the SharePoint libraries SP.js, SP.Runtime.js and SP.Taxonomy.js inside an Angular 8 application. The SP scripts call Type.RegisterNamespace. "Type" is a class inside of MicrosoftAjax.js. I want to understand how I can add all of these as a plugin so everything compiles and plays nice inside of Angular. If I can accomplish this it will open up all of the SP remoting calls (REST, basically) that a fully stand-alone Angular app can use to talk directly to SharePoint.

I added the script references to my angular.json file but that's not enough to get everything working. Also, MicrosoftAjax.js needs to load and initialize before the SP.js files start to run. If this is possible in Angular 8/9 (calling all Angular gurus out there!) I will be so thrilled.

I've used the @pnp/sp library to accomplish most of the things I need to but that library does not support interacting with 100% of the SharePoint environment. It's the SP.Taxonomy namespace that I really need to get at but without the MicrosotAjax library I don't think I can get the libraries to function.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Newclique
  • 494
  • 3
  • 15
  • After digging around some I found this link which may be what I need: https://www.c-sharpcorner.com/article/how-to-read-sharepoint-termstore-managed-metadata-in-sharepoint-framework-spfx/ – Newclique Mar 31 '20 at 19:48
  • Also, I did manage to get everything working by just concatenating all of the SP.js script files into one, large file and then referencing it in my TypeScript module. I mean, why not? It's essentially the same thing that webpack is gonna do anyway. – Newclique Mar 31 '20 at 19:49

0 Answers0