Showing posts with label Kirti Prajapati. Show all posts
Showing posts with label Kirti Prajapati. Show all posts

Friday, May 1, 2015

Creating a new customized Master page in SharePoint 2013

I was working on SharePoint 2013 pilot project and I need to integrate customized HTML into Master page for this (publishing site). SharePoint 2013 comes up with new feature called “Design Manager” (This feature available only for publishing site). In SharePoint 2010 we have an option to create a customized master page using SharePoint Designer 2010 (in most cases). Design Manager allows us to create a Master Page in SharePoint 2013 from an existing HTML page which has associated graphics, scripts, CSS files, Java Scripts, JQuery etc. In previous versions it required an ASP.NET developer to create dynamic pages, but Design Manager Feature allows designers to create dynamic pages. We can integrate HTML using SharePoint Designer 2013 as well. I have created a HTML which looks like below image (which I am going to convert into Master Page)Design/Plan your Master Page Generally, Master page in any technology represents elements which remains same from page to page and associated with master styles, scripts, fonts, images etc. Same concept applies for SharePoint master pages as well. For this project, I wanted to use these amounts of content in master page as all the central style sheets, JavaScripts, images, etcThe content in the below part of the page is what will governed dynamically by SharePoint using a combination of Page Layouts and dynamic content. I will add few more design areas later on into the same master page. I am assuming you have designed/created a stripped down HTML file that has the chrome isolated with the appropriate images, CSS, JavaScript, etc. in folders. I have designed my HTML and the folder structure for this looks like :  Now We are ready to create Master Page in SharePoint 2013. Create a SharePoint 2013 Account I have used cloud based environment to deploy this Master page because its easy and free for the moment. You can download and install the SharePoint 2013 Preview and work locally as well. You can create an account from here to signup for an account. Create Publishing Site Collection Once you are done with your SharePoint 2013 account creation, you are allocated a public facing web site and a collaboration site along with Central Administration area to manage all your site collection and sites. You can use public facing web site as well, but I would recommend to create a separate Publishing Site Collection as Microsoft allows one public facing web site in the current cloud environment. To create it, go to Admin--SharePoint--Site Collection and click on the New Private Site Collection link.              It will allow you to create a  Site Collection using different templates. We will use "Publishing Portal" Template.  Now we have a Publishing Site ready, we can start to customize it with new Master Page. The Default home page will look like this:

How to use Design Manager

You can see two different areas on the default home page. One for Information Architecture and second for Visual Designer. If you click on “Design your site”, this will bring you to SharePoint 2013’s new Design Manager:

Note: You can also reach this screen by clicking on the settings menu at the top right hand of the page and clicking on Design Manager

Map Master Page Directory

Click on 4. Edit Master Pages and you will see a screen like this:

Now we are going to Convert an HTML file to a SharePoint master page (as i said earlier). Click on that link and you will see this dialogue box:

This directory is the folder containing Master Page and Page Layouts as well as their dependent assets (CSS files, scripts, images, etc.). I have already uploaded the folder structure (you can see css, images, and fonts folder in above screen). You can manage this folder by mapping to network drive in Windows.

Note: Upload all your folders and .HTML page at this location

Creating Master Page from HTML

Now we have uploaded our files, we’re going to create a Master Page. how it converts? SharePoint 2013 can take the HTML file and convert it into a ASP.NET Master Page automatically. It will also link the HTML and Master Page together so that if any change happen to HTML file it will sync these changes into the Master Page. This allows designers to now work in their comfort zone with HTML, CSS, JavaScript, etc. Go to the Design Manager. Click on 4. Edit Master Pages and then click on Convert an HTML File to a SharePoint master page. You will see your HTML page over there. Select that page and click on "Insert" button. It will insert master page into Design Manager's Master pages list.NOTE: SharePoint 2013 expects your HTML to be XML Compliant. If you have older or non-compliant HTML you will get an error. Fix your file and try again. To preview this page, click on the Master Page. At the bottom of the page you will see a Yellow Box that represents the place holder where dynamic content is going to be inserted. Publish it When you insert HTML page into Master Pages list, it would be in Draft version. We need to publish it otherwise it will not be available in Site Master Page Settings drop down. To publish it, go to Site Settings -- Master pages and page layouts and then find your HTML file. Hit the Publish button on the ribbon. Assign it To assign master page, go to Site Settings –> Master Page (under Look and Feel) and select your master page from the drop down list. Your site will now adopt your new look and feel. My page looks like this after publishing it on SharePoint 2013.

 


by Kirti Prajapati via Everyone's Blog Posts - SharePoint Community

Publish app to non-developer site collection

Visual Studio allows developers to deploy/publish Apps for site (site collection) which has been created using Developer Site Template. Recently, I was working for SharePoint 2013 Apps for one of my customer. App was developed using VS 2013 and published on Developer Site Collection (On O365) to test the functionality. However, it was not working (getting an error "sideloading of apps is not enabled…" while publishing app through visual studio) on customers SharePoint 2013 Online Portal as that portal was non-developer site collection.

Reason for this error: 

Visual Studio calls the Microsoft.SharePoint.Client.AppCatalog.IsAppSideloadingEnabled method for the given site collection URL, which returns true if the site is a developer site or if the site has the sideloading feature enabled. For a Site Collection to work which is not a developer site, the sideloading feature must be enabled.

Enabling app sideloading requires tenant admin permissions (in a multi-tenant environment) or farm admin permissions (in a single tenant environment). When you begin development in Visual Studio against any of the site URLs above without these permissions, the error "Sideloading of apps is not enabled on this site" will appear and the app installation will fail.

Problem: How to publish that app on non-developer site collection

Solution: There are two solutions available for apps deployment on non-developer site collection.

1. Use "app sideloading" feature

2. Create App Catalog for an Organization

1. Use "app sideloading" feature

What is app sideloading?

App sideloading is the ability to install a SharePoint 2013 App directly into a site to explicitly bypass the regular governance controls of SharePoint. It is a developer/test feature not intended for production use. It is not recommended to sideload apps regularly, or keep app sideloading enabled for longer than you are actively using the feature!

The developer site is designed for app developers to install and test apps before they are ready to release/publish on store.

Note: Search and Project site collection templates are not compatible with the Developer Site template.
Developers cannot test apps designed for use with those templates with the developer site alone.

The sideloading feature enables development against site collections that use a different template without affecting the UI. By enabling sideloading, an admin opens the door for anyone with app install permissions to install apps that are not sourced from the app catalog or app store.

Why this feature is not activated by default if it seems very useful?

Sideloading apps is insecure. The main reason for blocking sideloading by default on non-developer sites is the risk that faulty apps pose to their host web/host site collection. Apps have the potential to destroy data and make sites or, given enough permissions, can even make site collections unusable. Therefore, apps should only be sideloaded in dev/test environments and never in production.

It is not recommended to activate this feature. But you can find the steps as below for reference:

1. Install the SPO management shell

2. Download this script from code repository

3. Execute EnableSideLoading.ps1 from PowerShell.

4. Provide the URL for the site collection where sideloading should be enabled.

5. Enter your user credentials. You must be a Tenant Admin to activate this feature.

6. Once the script has run successfully, you should be able to install apps from Visual Studio!

Note: When it is no longer needed to sideload apps, make sure to disable app sideloading feature

Download this script from code repository to disable the feature.

Note: Activating app sideloading will enable you to load apps from Visual Studio, but will not get you any other features of the developer site—you will not have access to Napa or the app packages library. For these reasons, along with the other rationalizations above, it is highly recommended that you use a developer site for app loading/testing instead of sideloading or create an App Catalog for an Organization.

To view the logs for sideloading activation/deactivation, execute the PowerShell cmdlet get-spologs.

2. Create App Catalog for an Organization

An app catalog is a dedicated site collection in a SharePoint 2013 web application (or a SharePoint Online tenancy) that hosts document libraries for apps for SharePoint and apps for Office. Administrators can upload apps for Office manifest files to the app catalog for use within their organization.

To set up the app catalog for an instance of SharePoint Online, follow these steps:

To set up an app catalog on SharePoint Online

  1. On the Office 365 admin center page, choose Admin, and then choose SharePoint.
  2. In the left task pane, choose apps.
  3. On the apps page, choose App Catalog.
  4. On the App Catalog Site page, choose OK to accept the default option and create a new app catalog site.
  5. On the Create App Catalog Site Collection page, specify the title of your App Catalog site.
  6. Specify the web site address.
  7. Specify the time zone, administrator, storage quota, and server resource quota, and then choose OK.

To add apps for Office to the App Catalog Site, browse to the site you have just created. In the left navigation pane, choose Apps for Office, and then, to upload an app for Office manifest file, choose new app.

I hope this difference aware developers to publish Apps for SharePoint on production box using App Catalog only.

 


by Kirti Prajapati via Everyone's Blog Posts - SharePoint Community