Wednesday, December 7, 2016


SharePoint 2013/10 - Add a Image or Div to scroll top of page


Simple way to add a go top of page image or link or div on the SharePoint pages to avoid scroll.

Add the below tag with proper image src to your page or master page.

<div id="goUp" style="position: fixed;bottom: 20px; right: 100px;"><a href="#suiteBar"><img src="/up.png" width="30px" height="30px"</a></div>




Happy Browsing!
Relax..

Saturday, September 10, 2016

SharePoint 2013 - To hide ribbon menus from SharePoint Pages


Sometime its annoying to have ribbon control which exposes all the menu ( new item, settings, etc to have it on all the list view pages). In order to hide Item menu and control some sections from List view from ribbon, I used below style sheet. We can use other many to hide as we want. Some how we have to use the \ behind  . for using this on style sheets as below


/*For to hide designer section*/
#Ribbon\.List\.CustomizeList {
display: none !important;
}

/*For to hide items section*/
#Ribbon\.ListItem-title {
display: none !important;
}
/*For to hide setting section*/
#Ribbon\.List\.Settings{
display: none !important;
}
/*For to hide list view section*/
#Ribbon\.List\.ViewFormat{
display: none !important;
}

/*For to hide page section*/
#Ribbon\.WikiPageTab-title{
display: none !important;
}



Happy Browsing!
Relax..

Thursday, August 25, 2016

SharePoint 2013 - Horizontal Breadcrum for Navigation


To get the breadcrum in the SharePoint 2013, use the below scripts.  
The navigation comes like - "Site Name > Sub Site name > Page Name " and etc.

Step 1: Please take a backup of masterpage that you currently have and create a copy. ( Directly working on the master page is a bit risk)
Step 2: Place the below code in the master page 
(anywhere - above toplink bar, above  content placeholder, or in the suite bar)
<SharePoint:AjaxDelta ID="deltabreadcrumbnav" runat="server"> <div id="breadcrumbnavigation"> <span class="breadcrumb-nav"> <asp:ContentPlaceHolder ID="ContentPlaceHolder" runat="server" > <asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap" SkipLinkText="" runat="server"/> </asp:ContentPlaceHolder> </span> </div> </SharePoint:AjaxDelta>

Step 3: Save the file and upload in the master page gallery and publish the master page
Step 4: Try this new master page in a sub site ( to avoid any mess)  - Go to setting set the new master page as default. 
Step 5: Navigation should be up and running with default titles. 


Happy Browsing!
Relax..

Article Source: Microsoft Forum

Thursday, June 23, 2016

SharePoint 2013/2010 OTB Model Dialog Pop Up Window

To open a page in a pop up window, try this simple script.

Add the below script in the page your are good to go or add this in your master page and pass the parameter to this function to utilize this from any page or webpart.


< script type="text/javascript">
function OpenDialog(){        
var options = {            
url:'http://pageurlcomeshere',            
width: 500,            
height: 300 };          
SP.UI.ModalDialog.showModalDialog(options);
}     
</ script>

In the body
< a href="#" onclick="OpenDialog();">Open Dialog


PS: Use to avoid the execute script load errors. SP.SOD.execute("sp.ui.dialog.js", "SP.UI.ModalDialog.showModalDialog", e);

Dialog Option
title: "Dialog Title" --> to set title for pop up window
allowMaximize: dialogAllowMaximize, -----> To allow maximize
showClose: dialogShowClose, ------> Show close button options



Advance Options: Modal Dialog Options Call backs


To handle the Ok or Cancel from Modal Dialog window, you can use the scripts as follows

Option 1: To refresh on any action of modal box  use below in option dialogReturnValueCallback:RefreshOnDialogClose
 Example:

< script type="text/javascript">
function OpenDialog(){        
var options = {            
url:'http://pageurlcomeshere',            
width: 500,            
height: 300,
dialogReturnValueCallback: RefreshOnDialogClose
};          
SP.UI.ModalDialog.showModalDialog(options);
}      
</ script>

Option 2:  To refresh on Ok but not close/cancel events
dialogReturnValueCallback: CheckOnDialogClose  //( below is the method)

OR

dialogReturnValueCallback: function(dialogResult) { if (dialogResult != SP.UI.DialogResult.cancel){SP.UI.ModalDialog.RefreshPage(dialogResult)}}


 Examples:
 function OpenDialog()
{
var e = {
            title: "Dialog Title",
            url: "http://Server/Pages/message.aspx",
            width: 500,
            height: 250,
           dialogReturnValueCallback: function(dialogResult)
        {
            if (dialogResult != SP.UI.DialogResult.cancel)
            {
                SP.UI.ModalDialog.RefreshPage(dialogResult)
            }
     }
            //dialogReturnValueCallback: CheckOnDialogClose
        };
        SP.SOD.execute("sp.ui.dialog.js", "SP.UI.ModalDialog.showModalDialog", e);

}


/* Separate function to handle popup return back calls*/

function CheckOnDialogClose(result, target) {

     if(result==SP.UI.DialogResult.OK) {
        SP.UI.ModalDialog.RefreshPage(dialogResult)
       }
        if(result==SP.UI.DialogResult.cancel){ 
/*
          SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel,'Cancel Clicked');
           alert("Canceled Clicked"); //No refresh
*/
          }    

 }


Article Source: http://msdn.microsoft.com/en-us/library/office/ff410058%28v=office.14%29.aspx

Happy Browsing!
Relax..

Thursday, June 9, 2016

SharePoint - Save as Site Template for Publishing Site 

 

SharePoint publishing sites by default does not allow you to create site templates. 
A quick fix for this OTB is as follows

1. Open the site in SharePoint Designer and in the ribbon , under Site Options, look for SaveSiteAsTemplateEnabled and set this to true value.
2. Open the site and_layouts/savetmpl.aspx. Or. /_layouts/15/savetmpl.aspx.
3. Save the site.

If the saved template is not showing up while creating sub site then go to the site settings and into 'Page layouts and site templates' and add the requested site template to the allowed list of site templates.Now it should be ready to go.

 

 

Happy Browsing!
Relax..

 

Thursday, March 24, 2016

SharePoint -Export List to Excel from Custom Link

 Steps to export ( excel ) list view from custom hyper link or button or JavaScript.

 1.  Add regular hyperlink href or button or java script function and look for the onclick event

2.  Update the  href/url part to the below given pattern
<server URL>/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=<List ID>&View=<View ID>
You can get the List ID or View ID  when you modify a view or from list setting page

3. Save and start exporting a view directly instead of ribbon command!


Happy Browsing!
Relax..