Posts

Un-Extend and Re-Extend a Web Application

To update the URL or IIS bindings of a Web application, you must unextend and re-extend the Web application, and reconfigure alternate access mapping URLs or IIS Web site bindings. Unextending and re-extending a Web application If you need to change your IIS bindings, unextend the Web application from the zone that the Web application has been extended into (without deleting the Web application), and then re-extend the Web application into the same zone. Consider trying these migration procedures in a test environment before deploying them in a production environment. Unextend the Web application from the zone by using the Remove SharePoint from IIS Web site link on the Central Administration Application Management page, as described in the following procedure: Unextend a Web application 1.On the SharePoint Central Administration Web site, on the Application Management page, in the SharePoint Web Application Management section, click Remove SharePoint from IIS Web site. 2.On ...

Show PDF File from Document Library in a SharePoint Page

<div id="DocumentFrame" > </div> <script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(loaddocuments, 'sp.js'); function loaddocuments() {     //fetch the list of items using the client object model     var context = new SP.ClientContext.get_current();     //get the current website     var web = context.get_web();     //get the Document Library list     var list = web.get_lists().getByTitle('Documents');     //create the query to get all items     //var query = SP.CamlQuery.createAllItemsQuery();     var camlQuery = new SP.CamlQuery();     camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'ID\' Ascending=\'FALSE\'/></OrderBy></Query><RowLimit>1</RowLimit></View>');     //get all items from the query     docdatas = l...

Calculate the View Count of a list item using Javascript

<script language="ecmascript" type="text/ecmascript"> var itemId=GetQueryStringParams('id'); SP.SOD.executeOrDelayUntilScriptLoaded(getSetListItem,'SP.js'); var listItem; var list; var clientContext; function GetQueryStringParams(sParam) {     var sPageURL = window.location.search.substring(1);     var sURLVariables = sPageURL.split('&');     for (var i = 0; i < sURLVariables.length; i++)     {         var sParameterName = sURLVariables[i].split('=');         if (sParameterName[0] == "ID")         {             return sParameterName[1];         }     } }         function getSetListItem() {             this.clientCon...

Find the Latest Document from Document Library and display the content using Javascript

<script type="text/javascript"> SP.SOD.executeOrDelayUntilScriptLoaded(loaddocuments,'SP.js'); function loaddocuments() {     var context = new SP.ClientContext.get_current();     var web = context.get_web();     var list = web.get_lists().getByTitle('Documents');     var camlQuery = new SP.CamlQuery();     camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'Modified\' Ascending=\'FALSE\'/></OrderBy></Query><RowLimit>1</RowLimit></View>');     docdatas = list.getItems(camlQuery);     context.load(docdatas, 'Include(FileLeafRef,FileDirRef)');     context.executeQueryAsync(         Function.createDelegate(this, this.success),         Function.createDelegate(this, this.failed)); } function success(sender, args) {    ...

Get Current User Details from SharePoint Profile Store using Javascript

When you want to use the below script on your application, change the ID's of the TEXTFIELD <script type="text/Javascript>     SP.SOD.executeOrDelayUntilScriptLoaded(runMyCode, "SP.js");     function runMyCode() {         var ctx = new SP.ClientContext.get_current();         var web = ctx.get_web();         ctx.load(web);         var user = web.get_currentUser();         user.retrieve();         ctx.executeQueryAsync(   function () {       document.getElementById("ctl00_m_g_ef1f7edf_a38d_4a18_bd9a_647d0c847d62_ff21_ctl00_ctl00_TextField").innerText = user.get_title();       document.getElementById('ctl00_m_g_ef1f7edf_a38d_4a18_bd9a_647d0c847d62_ff21_ctl00_ctl00_TextField').readOnly ...

Dynamic Scrolling image creation using JavaScript

Step 1: Create a list named "Header-Scrollable-Images" Step 2: Create a choice column with the value of "Yes / No" Step 3: Create a column of hyperlink / Picture. Site Actions --> Edit Page --> Add a Web part --> Select Content Editor Web part Add the Script in a txt file and refer the file in the CEWP or Paste the below code directly in CEWP <div id="sliderFrame"> </div> <script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(loadSharePointPictures, 'sp.js'); function loadSharePointPictures() {     //fetch the list of items using the client object model     var context = new SP.ClientContext.get_current();     //get the current website     var web = context.get_web();     //get the pictures list     var list = web.get_lists().getByTitle('Header-Scrollable-Images');     //create the query to get all items   ...

Add or Remove the Quick Launch Menu Control

There are four ways to add or remove the Quick Launch menu control from your SharePoint pages and sites. You can apply these techniques for other SharePoint controls as well. The techniques are: Using the SharePoint web interface or SharePoint Designer 2010 Using a master page Using a page layout Using a Content Editor Web Part Create a CSS file and add the following Code #s4-leftpanel { display:none; } .s4-ca { margin-left:0px!important; } If you want to hide the Quick Launch menu in most publishing pages and display it in only a few pages, you can keep the Quick Launch menu control visible in the master page, reference a CSS file in the master page that hides the Quick Launch container, and reference a CSS file in your page layout that shows the Quick Launch menu. Here is the CSS code to show the Quick Launch menu: #s4-leftpanel { display:inherit!important; width:155px!important; } .s4-ca { margin-left:155px!important; }