Itemupdating event receiver Skype sex on the web

We must make use of Custom Actions with Share Point App Model in order to implement Embed Java Script Pattern by utilizing location identifier Script Link that can be accessed through User Custom Actions collection of SPWeb Object.

In this in this article we will see how to implement Embed Java Script Pattern in real time business applications as below- Lets’ start with a Share Point App Project by selecting App for Share Point Project Template Specify the Site URL Choose Provider-Hosted as hosting model in order to develop High Trust Apps Choose ASP.

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.

It is the responsibility of the App Developer to handler the smooth removal of the injected code as soon as the App gets uninstalled.

There are a couple of issues that I would like to point out around this fact as follows: If code is injected using Share Point Hosted App, then it is not possible to get it removed the injected code automatically by any mean.

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.

itemupdating event receiver-72

Using Client Side Frameworks such as JQuery along with this technique we can perform DOM Manipulation (adding, removing, modifying HTML Elements) as and when needed in whichever ways.Then we are retrieving the User Custom Actions collection in context of the Host Web and adding the new User Custom Action with Location as Script Link and Script Block as dynamic script block created earlier Steps 10 – Inside Remove Java Script Function we are removing the User Custom Action from the User Custom Actions collection in context of the Host Web based on the Description & Location property of the User Custom Action. Now lets’ run the App and see it in action by pressing F5 in Visual Studio Once the App launched we can see the UI with a Result Panel & two HTML Buttons If we look the Host Web before embedding the script to it, it would look like as follows.Notice we have default Site Icon and Title which was provided at the time of site creation Now on App Page click on Inject Java Script to Host Web button to push custom Java Script into the Host Web On clicking the button we can see the success message in the Result Panel confirming that the Java Script has been applied to the Host Web If we revisit the Host Web we can see the Site Icon and Title has been changed as per the code we had added to the custom Java Script File that we have injected into Host Web And since this change takes place at the Master Page Level, we can see the effect of the change all across the site on every screen as shown below: Now in order to unplug the Java Script based customizations out of the Host Web we can click on Remove Java Script to Host Web Once the Remove operation has been completed successfully we can see the result panel confirming the success of the operation.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.

Leave a Reply