Monday, 15 October 2018

Sharepoint WSP Solution BackUp and Deployment



//For WSP Backup
$farm = Get-SpFarm 
$file = $farm.Solutions.Item("WSP_Solution.wsp").SolutionFile 
$file.SaveAs("E:\FolderName\WSP_Solution.wsp")


//Before add WSP solution, Retract solution from central admin Farm solution and remove Solution from there.
Add-SPSolution "E:\FolderName\WSP_Solution.wsp"
Install-SPSolution –Identity WSP_Solution.wsp –WebApplication "Web App url" –GACDeployment

Sunday, 7 October 2018

Disable Future Dates of Calendar from SharePoint Default Forms

//Add this script inside forms or page's script editor

<script src="//code.jquery.com/jquery-3.2.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
var getSPDayDiff = function(date) {
return Math.round(Math.abs(( new Date(1601,0,1).getTime() - date.getTime())/( 24*60*60*1000 ) ) );
}
$(function () {
debugger;
var currentDate = new Date();
//currentDate.setMonth(currentDate.getMonth() + 1);
var minDay = getSPDayDiff(new Date());
var maxDay = getSPDayDiff(currentDate);

var datePicker=$("img[alt='Select a date from the calendar.']").parent();
var onclickStr=datePicker.attr("onclick");
//onclickStr=onclickStr.replace("minjday=109207", "minjday="+minDay);

        onclickStr=onclickStr.replace("minjday=109207", "minjday=109207");

onclickStr=onclickStr.replace("maxjday=2666269", "maxjday="+maxDay);
datePicker.attr("onclick",onclickStr);
});
</script>