Monday 19 June 2017

"Save site as template" option isn't available in SharePoint Online in Office 365 or SharePoint Server 2013

PROBLEM

When you browse to the SharePoint Online or SharePoint Server Site settings page, you discover that the Save site as template option isn't available.

MORE INFORMATION

This issue most frequently occurs because the Community Sites Feature site feature, the SharePoint Server Publishing site feature, or the SharePoint Server Publishing Infrastructure site collection feature is currently enabled or was previously enabled for the affected site.

SharePoint doesn’t support creating a template from a site where publishing or community features were enabled. This is because the publishing feature creates site elements that are not supported as part of a template, and these elements remain even when the feature is disabled. This also includes templates that were created through SharePoint Designer.

Note Although the Save site as template option may become available after you deactivate publishing features, it is still unsupported to create a template from a site that has ever had publishing features enabled. If you create a site from this template, you may encounter problems when you try to activate publishing on the new site. For example, you may receive the following error message:
Provisioning did not succeed. Details: Failed to initialize some site properties for Web at Url: '......' OriginalException: Failed to compare two elements in the array.
In SharePoint Online, if you disabled scripting capabilities for the affected site, this also removes the Save site as template option.

For more information, go to the following Microsoft website:
Turn scripting capabilities on or off

Although you can't use the Save site as template option in this scenario, you can use the app model to customize the provisioning process in SharePoint Online or SharePoint Server 2013. This lets you enable specific features, capabilities, and branding for your sites.

For more information, go to the following Microsoft website:
Self-service site provisioning using Apps for SharePoint 2013

WorkAround / Solution

Save Site As Template In SharePoint Online

Notice anything missing from your Site Settings page recently? If you're in a SharePoint site on Office 365, Microsoft has quietly (with a loud response from the blogosphere) removed the Save Site as Template option. Using this classic option, which places a WSP file in the site collection's solution gallery, is supposed to provide an easy way for an end user to re-use the configuration of a site.

Microsoft, as far as I know at this time, has yet to officially deprecate this functionality from SharePoint Online. It is still intact with SharePoint 2013.

They are hiding this from you for various technical reasons in favor of more sustainable site templating practices. I could explain them all if it wasn't mostly outside my wheelhouse... It has to do with SharePoint Apps, upgradability, etc. What matters at the moment for a site administrator is that there is currently no longer a user-accessible option to template a site, with or without content. Or is there?

Some posts are out there that describe adjusting or adding the SaveSiteAsTemplateEnabled property of the site to TRUE via PowerShell or SharePoint Designer. This appears to not be necessary except in the case of enabling SharePoint's publishing feature(s).

I conducted a test today on a plain site based on an OOTB team site template as well as a plain site based on an OOTB project site template. The page for saving a site as a template still exists if you append the following:

/_layouts/15/savetmpl.aspx

to the URL of your site. Voila! Your familiar page appears.

Reference:
A Quick Tip for Copying a Site in SharePoint Online
Save Site As Template In SharePoint Online
"Save site as template" option isn't available in SharePoint Online in Office 365 or SharePoint Server 2013

Wednesday 14 June 2017

How To Hide Ribbon From Users Without Edit Page Privilege

Ribbon is a great new feature introduced by SharePoint 2010. It provides great user experience for users with elevated privileges, like contributors and site owners. However, for users with lease privilege, such as visitors and anonymous users, it seems like a big waste of page real estate. Because for those users, all ribbon provides are navigation breadcrumb and welcome control (user name with a drop down list on top-right corner).
So I have been asked to figure out a way to remove or hide the ribbon area from user with lease privilege, and here is how:
1)      Open your SharePoint master page
2)      Locate this line:<div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle”>
3)      Change it to:<div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle” style=”display:none”>
4)      Now find the end of the “s4-ribbonrow” tag and add following block right after it:<Sharepoint:SPSecurityTrimmedControl ID=”SPSecurityTrimmedControl2″ runat=”server”PermissionsString=”AddAndCustomizePages”>    <script type=”text/javascript”>        document.getElementById(“s4-ribbonrow”).style.display = “block”;
    </script>
</
Sharepoint:SPSecurityTrimmedControl>
5)      Save the new master page and publish it.
Now when a user without “AddAndCustomizePages” access to view the site, they would not see the ribbon area. You may want to move at least the welcome control to somewhere outside the ribbon area so your lease privilege users can see their user names.
The reason that you have to do it the other way around: make the ribbon invisible (step 3) and make it visible only when users have “AddAndCustomizePages” access (step 4) is the ribbon HTML code has to be rendered to the browser otherwise you would lose some basic abilities on the page, like, to be able to scroll up and down.
Enjoy your page real estate back!

Reference :

Monday 12 June 2017

O365 SharePoint Site - How to replace the default Master Page?

In order to set a new masterpage will have to upload it to the Masterpage Library which is located at: https://domain.sharepoint.com/_catalogs/masterpage
To assign the masterpage to your site go to Site Settings > Design Manager > Publish and Apply Design > Assign master pages to your site based on device channel.
Choose your Masterpage from the dropdowns, specify whether you want to "Reset all subsites to inherit this site master page setting" or not. Then hit OK.
After a refresh you should see your new masterpage in action.

References :

Thursday 8 June 2017

PowerShell script causes “The context has expired and can no longer be used. (Exception from HRESULT: X80090317)” issue

Stack Overflow 

Query: 
Currently I have 3 different SharePoint environments; DEV,UAT and PROD. These environments have same server topology and same software installations.

I populate some SharePoint lists and a SQL Server database with PowerShell. PowerShell script works fine under DEV and UAT. It also works well on PROD. However, whenever I run the script in the PROD, SharePoint site starts displaying;

Sorry, something went wrong

The context has expired and can no longer be used. (Exception from HRESULT:X80090317)
There is no such problem neither on DEV nor UAT. I assume that some configurations are different on the PROD but I couldn't find which ones they are.

What is the problem here? How can I avoid this?

Solutions :
Similar to the above answer but check if the web application time zone and the server time zone are identical, you could refer this article: Time zone issue

Time Zone Issue :

How to fix SharePoint 2013 Web Application error “The context has expired and can no longer be used”


I came across this odd error a couple of times in the past few weeks, so I wrote a quick guide that might help you get rid of it.
If you see this error after opening your SharePoint 2013 site, there is a lack of synchronization between Date and Time settings in your SharePoint 2013 Server and your SharePoint web application.
Sorry, something went wrong. The context has expired and can no longer be used. (Exception from HRESULT: 0x80090317)
Here is how you fix it!
  • Open Central Administration -> Application Management.
  • Locate the relevant Web Application and click on 
  • Web Application General Setting window will open up, notice that the Default Time Zone is missing.
  • Open Date and Time options on your server and check which time zone is configured. Configure the same time zone in Web Application General Setting.