Thursday, July 18, 2019

SharePoint Online :  Access denied when uploading .aspx page to SitePages

By default, SharePoint online does not allow uploading custom .aspx pages to its site pages library.


For people with applications developed on pure react/angular and want to migrate content to SharePoint Online would be a blocked unless you want to migrate to SPFx.

Resolution:
This can be fixed by running custom scripts from admin console using  the SharePoint Online Management Shell to execute the script below.

PS Command:

$adminUPN="name@business.com"$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."

Connect-SPOService -Url https://business-admin.sharepoint.com -Credential $userCredential


After this connection establishment, run the following script to connect to your site and enable

Set-SPOSite -Identity https://business.sharepoint.com/sites/site1/ -DenyAddAndCustomizePages $false

This should enabled uploading custom files to online site pages in the SharePoint Online.
If still issues persists, try enabling the allow custom scripts and try to run the scripts and you can disable it back.



Hope this helps…

Happy Browsing!
Relax..

Tuesday, January 31, 2017

SharePoint 2013/10 - Infopath Forms - Multiline Text box not splitting lines


InfoPath forms when used on the SharePoint list, some multi-line fields will not show line breaks and it keeps in one liner while read or edit of form.

To fix this issue, you can add a small css correction on the master style sheet or as is required.
InfoPath form multi-line text box will render as text area and hence below css will override it wrap the text.

textarea
{
    white-space: pre-line !important;
}

Please this as is on your css or on page as required to over come this issue. Hope this helps.



Happy Browsing!
Relax..

Wednesday, January 18, 2017

SharePoint 2013/10 - Generate PPT presentation from SharePoint List Data

Trying to Generate PPTX presentation from SharePoint - try this

Include the PptxGenJS framework in an HTML webpage (client-side) or Node.js project (via NPM) to gain the ability to quickly and easily produce PowerPoint presentations with a few simple JavaScript commands.

Source:  http://gitbrent.github.io/PptxGenJS/

You can use the above code with SharePoint CSOM code to make it dynamic to pull reports and ppt's

Happy Browsing!
Relax..

 

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..

Tuesday, November 17, 2015

SharePoint - To Play Video from Video Library with carousel

Include this below scripts and update the video library as required in a content editor webpart.

<script type="text/javascript">
    function ShowPlayer(PlayerId) {
        var elm = document.getElementById(PlayerId);
        elm.style.display = 'block';
    }
    function HidePlayer(PlayerId) {
        var elm = document.getElementById(PlayerId);
        elm.style.display = 'none';
    }
  </script>

<div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div style="width:176px;height:104px;background-image:url('/film1.jpg');
                cursor:hand;"
                onclick="ShowPlayer('divp');
                playerp.controls.Play()" >
                <div id="divp" style="display:none;">
                <object classid='objPlayerID'
                id='playerp'
                width='174'
                height='104'
                standby='Please wait while the video is loaded...'>
                <param name='url' value='/film1.wmv' />
                <param name='src' value='/film1.wmv' />
                <param name='TransparentAtStart' value='0' />
                <param name='AutoStart' value='0' />
                <param name='CurrentMarker' value='0' />
                <param name='Balance' value='0' />
                <param name='CurrentPosition' value='0' />
                <param name='showcontrols' value='false' />
                <param name='enablecontextmenu' value='false' />
                <param name='fullscreen' value='False' />
                <param name='mute' value='false' />
                <param name='PlayCount' value='1' />
                <param name='rate' value='1.0' />
                <param name='uimode' value='none' />
                <param name='volume' value='100' />
                <embed type='application/x-mplayer2'
                pluginspace = 'http://www.microsoft.com/Windows/MediaPlayer/'
                name='playerp' ShowStatusBar='0' EnableContextMenu='0' autostart='0'
                width = '174' height = '129' loop='false'
                transparentatstart='true' src='/film1.wmv' />
                </object>
               
                </div>
        </div>

        <div style="text-align:left;">
                <img alt="" src=" /video_play.gif "
                title="Play" style="width: 82px;cursor:hand;height: 17px;padding-top:5px;"
                onclick="ShowPlayer('divp');playerp.controls.Play()" />
                <img alt="" src="/stop.png "
                title="Stop" style="width: 23px;cursor:hand;height: 17px;padding-top:5px;"
                onclick="HidePlayer('divp');playerp.controls.pause()";playerp.controls.stop(); />
                </div>
    </div>


Please update the source file, video locations, images for play, stop respectively to work correctly

Happy Browsing!
Relax..

SharePoint - To make Calculated Column as Hyperlink with URL parameters



 Steps to add a hyperlink column/field in the list with query string parameters.

1. Add a calculated field in the list and name it.  Select the calculated field type and in the calculation box, use the URL to compose the address string.
 Example :
 ="<a href='https://myserver/sites/team1?ProjectName="&Title&"'>"&Title&"</a>"

This will add the URL with server name and then add the query string parameter as title of that list item.

2. Select the Calculated field type as "Number".  Please do not select Single line of text. Number will give you the expected result as Hyperlink. (Decimals as Automatic.)

3. Save the field.

This will give the Hyper link the list column with query string parameter from other columns in that list.


Happy Browsing!
Relax..


Tuesday, June 16, 2015

SharePoint - HTML / JavaScript Banner - Static Sliding Images

This will give you a basic static image sliding code which you can apply on your home page. This will have images and link to any URL which is predefined in the HTML file. An easy and free approach for the rotating banner or images or div that can be used to decorate the home pages of your website.  It has been tested and works in latest versions of all browsers. I'm using the frames and JQuery library defined to support this model. These JQuery are free to download as is available from internet.

For dynamic sliding images , please refer this article. 


Click Here to Get the Source Code with JS and CSS files. Check for more (external).

Happy Browsing!
Relax..

Thursday, March 12, 2015

SharePoint 2013 - Creating Tiles (Box) looks Links


SharePoint 2013 support new features such as Tiles to represent the brief description on the Tiles(Box) and links associated to it. This will give a glossy look to the site landing page or other use.

Example:

To achieve this:
  1. Make sure you have enabled the "Getting Started"" features in the site features.
  2. Add new APP and search for "Promoted Links" App and create a new list with this template.
  3. Add the new items to list and specify the Image URL and Linsk for it with a short description to show in tile and give the order and save. 
  4. Add this App Part to show up in any page and set the Tiles View as default.

For tiles images, you can use the http://thenounproject.com/




Happy Browsing!
Relax..
 


Saturday, February 14, 2015


SharePoint 2013/2010 - Basic Static Tabs


In order to display webparts or iFrame in tabs, paste the code in content editor and link the files.

<link href="/css/tabcontent.css" rel="stylesheet" type="text/css"/>
<script src="/js/tabcontent.js" type="text/javascript"></script>

<ul class="tabs" data-persist="true">
   <li class="selected">
      <a href="#view1" targetid="view1" targetid="view1">Tab1 </a></li>
   <li>
      <a href="#view2" targetid="view2" targetid="view2">Tab 2</a></li>
 
</ul>
<div class="tabcontents">
   <div id="view1" style="display: block">content 1 </div>
   <div id="view2" style="display: none">content 2 </div>

</div>
CSS and JS file


Happy Browsing!
Relax..


Friday, January 23, 2015

SharePoint 2013/2010 - To show waiting screen/image while loading in background.

Pre-Setup: Please download and link the source file to jquery-1.10.2.js. Link to approprite bg imane abd loader image. Set the mail JavaScript in the master page for reuse of the code.

<script src="jquery-1.10.2.js"></script>
<style>
#loading { display:none; position:fixed; left:0; top:100; width:98%; height:100%;            background-image:url("/bg.png"); }
</style>

<script type="text/javascript" language="javascript">
function block_screen() {
   $("#loading").show();
document.getElementById('contentRow').style.display = 'block';
}
function unblock_screen() {
 $("#loading").hide();
document.getElementById('contentRow').style.display = 'block';
}
</script>
<div id="loading" > 
 <div id="loadingImage" style="position:fixed; left:450px; top:400px;"> 
<img  src="loader.gif" /> </div>
</div>


/*To Block Screen and Show waiting gif*/

<script type="text/javascript" language="javascript">
block_screen();
</script>


/*To Unblock Screen*/
<script type="text/javascript" language="javascript">
unblock_screen()
</script>

Happy Browsing!
Relax..

Wednesday, January 14, 2015

SharePoint 2013/2010 - To set any column as link to item.


In order to set the any column present in the list to link the item, by using the SharePoint designer, we can set this.
1. Open the list in the SharePoint Designer, and create a new view.
2. Open the newly created view and find <ViewFields> tag in it.
3. Add the bewlow tag to any column that you want to make as it as link to item.
4. LinkToItem="TRUE"  or linkToItem="TRUE" (use one which works in your allowed clienttemplates.js) and save it.

Other Field Types:
LinkToItem="TRUE"  => To display link to item.
LinkToItemAllowed="TRUE"   => display more option (...) to column .
Filterable="FALSE"   => To disable Column Filtering.
Sortable="FALSE" => To disable Column Sorting.




Happy Browsing!
Relax..

Wednesday, December 24, 2014


SharePoint 2013/2010 -Go Up folder in Document Library

Issue:
Some time when we customize the tile/navigation/breadcrumb, the link to document folder go up folder by will go missing. Here is a simple hack for it.

Resolution:
Just paste this code in content editor or script editor, and add an image suitable with updating the link.
PS: correct the links of folder to you library and site location. (highlighted part)

<script type="text/javascript">
function getParameterByName(name) {    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),        results = regex.exec(location.search);           return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));}

function GoUPFolder(){
if(getParameterByName('RootFolder')!="" && getParameterByName('RootFolder')!= "/teams/site/doclib"){
var url = getParameterByName('RootFolder').split("/");
var upfolder="";
for( var i=1; i< url.length-1; i++)
{upfolder=upfolder+"/" + url[i];}
window.location.href = "/teams/site/doclib/?RootFolder=" + upfolder;}
else{window.location.href = "/teams/site/doclib";}
}
</script>

<div id="divUpLink">
<img onclick="GoUPFolder();" style="cursor: pointer;" src='/teams/site/images/UpButton.gif'/>
</div>



Happy Browsing!
Relax..

Friday, October 10, 2014

SharePoint 2013/2010 - Model Dialog errors out when you use Site Pages


Issue
When you try to include a page from Site Page library in a Model Dialog box, SharePoint gives error with query parameter &IsDlg=1 and if you open the same page in normal browser without &IsDlg=1 , then it works fine.

Resolution
SharePoint  model pop will look for the webpart layout in the model pop page and the Site Pages are made of wiki layout, it fails. Try creating the page in the Pages Library with webpart layout and use in the model dialog, then it will work fine.



Happy Browsing!
Relax..

Friday, September 19, 2014

SharePoint 2013 - Setting up folder level Alert


If you are looking to set alerts for a specific folder and its contents, then please follow the steps


1. Look at the folder you want alerts on, from within the library, don't go into the folder.
2. Click on the '...' setting button for the folder you want an alert on
3. Click on the next '...' button and choose 'View Properties'
4. You should now be looking at the properties of the folder you want an alert on
5. Press the 'Alert Me' button from the ribbon.
6. Please Ensure the Alert Name includes the Document Library and its folder name . ex: Documents:Images
6.  Click on OK.

This should set the alert on the folder only, not the parent library.


Happy Browsing!
Relax..

Thursday, September 18, 2014

SharePoint 2010/2013 - To hide header ribbon row on the custom model dialog .

In many times, we want to hide the ribbon (with edit or other options) from the popup or some pages of SharePoint pages. In order to hide such cases, here is the quick fix.

Add the below code in the script editor . In order to apply this in generic, try a common JS file or may be a text file and then load in the pages using CEWP or script editor webpart

<style>
#RibbonContainer{
display:none;
}
#globalNavBox{
display:none;
}
#s4-ribbonrow{
height:0px !important;
}
</style>



Happy Browsing!
Relax..