The “Operation Context” class provides you methods (as highlighted below) to extract Absolute Uri to the Service Class irrespective of where it is hosted.
Steps 5 – Inside Load JSInside Host Web function, we are calling Load JQuery function to include JQuery file from the CDN and once loaded successfully it is calling Modify Host Web which will do the actual job of Injecting Java Script Code to the Host Web Steps 6 – Inside Modify Host Web function Steps 7 – Inside Load JQuery function we are loading JQuery File from the CDN Steps 8 – Here we are hooking up the button click event for Inject Js & Remove JS HTML buttons Inside each event handler we are calling Inject Java Script & Remove Java Script functions by passing Client Context to the Host Web & Web Object referring the Host Web and setting the notification message on the Share Point App Page (default.aspx) to show the status of the operation Steps 9 – Inside Inject Java Script function we are making use of Custom Actions Framework for Share Point to inject Java Script based customization inside the Host Web in the following steps- Preparing path of the Script file that we are going to inject into the Host Web and embedding it by creating the dynamic script block with src attribute set to the script file path.And we can go back to Host Web to ensure that the Site Icon and Original Title are restored back as usual.So we can clearly see the “Embed Java Script Pattern” is very effective as it gives you handle on customizing Host Web Elements from outside the Share Point itself.This requirement can be achieved simply by deploying a Farm Solution containing the Event Receiver SPI hooked up with the Products List Item Deleting Event.But what if we are not allowed to deploy any code solution in Share Point Environment?It is important to set following properties to get this Event Receiver added to the collection of Event Receivers of Product List.
Important Properties to set are- Event Type – Specifies the type of Event that can trigger receiver like here we are assigning it to “Item Deleting” Even Receiver Name – Specifies the unique name of this Event Receiver that can be used to identify it in Event Receivers Collection of Products List Receiver Url – Specifies the full path to Receiver.
If code is injected using Provider Hosted App, then it is possible to get it removed automatically by handling App Uninstalling Event using Remote Event Receivers.
Net Web Forms Application” as Project Template for the Remote Web Enter Certificate Details as we did in earlier demos On successful creation of the Solution two projects should be added as shown below.
“PH-Bind-Event-Receivers-With-Existing-List” – Represents the Code Base for the Provider Hosted App “PH-Bind-Event-Receivers-With-Existing-List Web” – Represents the Code Base for the Remote Web Select App Project and Press F4 to see the properties Under “App for Share Point Events” Set the Events that the App is required to respond to.
Assign the value of the Full Path that we have retrieved in Step 2 Sequence Number – Specifies the Sequence Number for the Event Receiver to add to the Event Receivers Collection of the Product List Step 7 – Add the Event Receiver Object to Products List Event Receivers Collection Step 8 – The other Event that we consider is “App Uninstalling”.