Monday, August 25, 2014

Save SharePoint Publishing site as Template

Hello Floks,

In one of our project, we need to save template of Publishing site. Microsoft restrict saving SP2013 Publishing sites as Template(more info).

Earlier version of SharePoint (Below than 2013) supports SharePoint does not support Save Site as Template option with the Publishing features turned on. The supported method to create templates for publishing sites is to use a site definition template and using a feature XML.

If you want to save publishing sites as templates there is a workaround. Since its forbidden there is no "Save site as a Template"  link in "Site Settings" page of publishing site. But you can get access to that page by using following URL:

/_layouts/savetmpl.aspx

But, this workaround can work on earlier version of SharePoint, in SP2013 this URL will work perfectly only for sites that have publishing features not activated. For publishing sites you get an error like

saving publishing sites as template is not allowed.

To allow this features work perfectly you need to do either of following steps:

Using PowerShell Script

$web=Get-SPWeb http://sharepointsiteurl[/subsite]
$web.AllProperties["SaveSiteAsTemplateEnabled"] = "true"
$web.Update()

Using SharePoint Designer

Open publishing site in SharePoint Designer click on File Menu from Top Navigation.

SharePointDesigner_SavePublisingSiteAsTemplate

Double Click or Click on Modify button once you select SaveSiteAsTemplateEnabled option.

 SharePointDesigner_PublishingSiteSaveAsTemplate

By default value is false update it as True and click on OK button and then Apply Button and again click on OK button of parent window.

SharePointDesigner_SaveSiteAsTemplate

Now you can access following page for Saving Publishing site As Template by using following URL:

http://publishing_siteURL/_layouts/savetmpl.aspx. 

Enjoy..:) :) :)

Tuesday, August 5, 2014

How to get value of Start Time & End Time in Caledar New & Edit Page using JavaScript

Output of above JavaScript on above dispayed image www.technologykhabar.wordpress.com-FetchEventStartTimeDateHello Friends. Today my friend facing an issue in fetching event Start Time from the Calendar New Page. She ask me to help her for fetching Event Start Time. As all developers do I analyze the code generated from SharePoint and verify the HTML and find the solution as describe below:

She needs value from drop down of the Event Start Time in JS when user click on Save button. So she is worrying about how to fetch single dropdown value of the page in JavaScript.

Calendar Start Time Field

Suppose when user click on Save button at that time selected value is displayed in above display picture then how to get value is describe below:

1). Fetch Date from the Event Start Time
$("input[title='Start Time']").val()

It will give result as displayed in below image.

www.technologykhabar.wordpress.com-FetchEventStartTimeDate

 

 

2). Fetch Time (Hrs.) from the Event Start Time
$("#" + $("label:contains('Start Time Hours')").attr("for")).find('option:Selected').text()

It will give result as displayed in below image.

Output of above JavaScript on above dispayed image

3). Fetch Time (Minutes) from the Event Start Time

Fetch Event Start Time Minutes

It will give result as displayed in below image.