In this article I would like to take you through a real-world problem. You are working on a Java Script method that should be deployed to multiple SharePoint servers. The Java Script needs to be included in the MasterPage file.How to deploy it?The manual deployment requires going to each SharePoint site, opening the page in SharePoint Designer and editing the MasterPage. This is time consuming and has maintenance overheads.How to Automate Deployment?We need to automate the deployment process. We can use the AdditionalPageHead delegate to render our custom code to MasterPage and everything through automated deployment.ProcedurePlease do the following:
Step 1: Create new projectOpen Visual Studio and create an empty SharePoint project and name it MasterPageCode. Choose the farm solution option.Step 2: Add User ControlAdd a User Control item to the project and name it MyControl. We will place our JavaScript code here.In the appearing user control, place the following code that says "Hello World" using JavaScript.<script type="text/javascript"> alert('Hello World');
Referenceshttp://msdn.microsoft.com/en-us/library/ms470880(v=office.14).aspxSummaryIn this article we explored a real world scenario. I hope the code will be useful in real-word scenarios of integrating Java Script or Custom Controls to every page.I have attached the source code along with this article.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: