READMESPRemoteAPI VSCode ExtensionDiscover what is available in SharePoint and Office 365 REST and JavaScript API without having to have SharePoint installed. Search for the type and browse the methods and properties. Check and see if the methods can be used in REST, JavaScript or if it is new to SharePoint 2016. Copy and paste into your code JSON post bodies and response payloads. Create TypeScript interfaces to enable intellisense and type checking. New in version 1.5 Create TypeScript InterfacesSelect the SharePoint type and click the "Create Interface" options Copy interfaces into your own Typescript file. Import and get intellisense and type checking. Using SPRemoteAPI Extension (Step 1)In VSCode just hit F1 and start typing SPRemoteAPI and you will see it appear in the drop down list. Using SPRemoteAPI Extension (Step 2)After selecting the SPRemoteAPI command you will be presented with all the available types in the SharePoint Office 365 remote API. You can start typing and the list will automatically filter as you type. The example below shows typing “move” and the list is filtered down to types with the word move contained in them. This list shows a github icon (flame) next to types that are new in SharePoint 2016. It also lists whether the type can be used in REST or JavaScript. Some types are not available for both. Using SPRemoteAPI Extension (Step 3)Once you have selected the type, you are presented an information dialog showing you the type along with options for displaying properties and methods or creating a TypeScript interface. The options also shows you the number of each contained in the type. Using SPRemoteAPI Extension (Step 4)Select the methods options and you are presented a list of available methods to choose. Using SPRemoteAPI Extension (Step 5)Choose a method and then you are presented a new code window (virtual document) containing a JSON representation of all the method’s information needed to call it remotely using REST. It shows you the parameter types, required post body and response body. The post body can be copied into whatever REST calling framework you are using such as FETCH or JQuery. The response can be used to guide you in what to expect in the payload response from the call. This gives you ability to write remote REST calls without having to do all the extra experimentation to see what the call returns. Having both the body and response JSON templates will save you a lot of time searching on the internet. What about properties?Below is example of the code window you are given when you select properties. It shows you all the available properties for the type and the information you need to determine what is available remotely from SharePoint Office 365. SPRemoteAPI in actionSupports SharePoint 2013This also supports SharePoint 2013, just add the following to your user settings: Enjoy! |