Tag Archive for SharePoint 2013

SharePoint: Create an administration page in SharePoint central administration

Custom administration pages can be used in Central Administration for a variety of purposes. One such scenario can be creating a page in CA for storing database connection string and using it in timer jobs. In this post we will create an administration page and use persisted objects to store data in SharePoint configuration database.

Create an empty SharePoint 2010 project with the following structure:

Copy this markup to the SampleCAAdminpage.aspx page.

<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages.Administration, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/_admin/admin.master" Inherits="SampleCAAdminPage.Pages.SampleCAAdminPage, SampleCAAdminPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a6ed85d3cc39e3bd" %>

EncodeMethod='HtmlEncode' />

runat="server">
EncodeMethod='HtmlEncode' />


EncodeMethod='HtmlEncodeAllowSimpleTextFormatting' />



Title="Database Connectionstring"
Description="Identify the connection string used for accessing the the database." >







Title="SharePoint List"
Description="Identify the list for data import." >





















Change the public key token in Page directive line to your value.

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/_admin/admin.master" Inherits="SampleCAAdminPage.Pages.SampleCAAdminPage, SampleCAAdminPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a6ed85d3cc39e3bd" %> 

Use the following code in connection.cs file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Administration;

namespace SampleCAAdminPage.Configuration
{
public class Connection : SPPersistedObject
{
private readonly static string NAME = typeof(Connection).FullName;

[Persisted]
private string mConnectionString;

[Persisted]
private string mListName;

///
/// Initializes a new instance of the class.
///

public Connection()
: base()
{
}

///
/// Initializes a new instance of the class.
///

/// The parent.
public Connection(SPPersistedObject parent)
: base(Connection.NAME, parent)
{
}

public string ListName
{
get
{
return this.mListName;
}
set
{
this.mListName = value;
}
}

public string ConnectionString
{
get
{
return this.mConnectionString;
}
set
{
this.mConnectionString = value;
}
}

///
/// Gets the ClaimsConnection details from local.
///

public static Connection Local
{
get
{
Connection result = SPFarm.Local.GetChild(Connection.NAME);
if (null == result)
{
try
{
result = new Connection(SPFarm.Local);
result.Update();
}
catch (Exception ex)
{
return null;
}
}

return result;

}
}
}
}

Use following code in SampleCAAdminPage.cs class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.ApplicationPages;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.WebControls;
using SampleCAAdminPage.Configuration;
using Microsoft.SharePoint.Utilities;
using System.Web;
using System.Web.UI;
using System.Data.SqlClient;

namespace SampleCAAdminPage.Pages
{
public class SampleCAAdminPage : ApplicationsManagementPage
{
protected InputFormTextBox txtConnectionString;
protected InputFormTextBox txtListName;
protected Button btnConnectionTest;
protected Button btnSubmit;

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!this.IsPostBack)
{
Connection connection = Connection.Local;

this.txtConnectionString.Text = connection.ConnectionString;
this.txtListName.Text = connection.ListName;
}
}

protected void btnSubmit_Click(object sender, EventArgs e)
{
Connection connection = Connection.Local;
if (null != connection)
{
connection.ConnectionString = this.txtConnectionString.Text.Trim();
connection.ListName = this.txtListName.Text.Trim();
connection.Update();
SPUtility.Redirect(PageToRedirectOnOK, SPRedirectFlags.Static, HttpContext.Current);
}
}

protected void btnConnectionTest_Click(object sender, EventArgs e)
{
try
{
using (SqlConnection connection = new SqlConnection(this.txtConnectionString.Text))
{
connection.Open();
connection.Close();
ShowMessage(this.Page, "Connection succeeded.");
}
}
catch (Exception ex)
{
ShowMessage(this.Page, ex.Message);
}

}

public override string PageToRedirectOnCancel
{
get
{
return "/applications.aspx";
}
}

public override string PageToRedirectOnOK
{
get
{
return "/applications.aspx";
}
}

public static void ShowMessage(Page page, string text)
{
// build up javascript to inject at the tail end of the page
StringBuilder stringBuilder = new StringBuilder();

stringBuilder.AppendLine("");

// add to the page
page.Controls.Add(new LiteralControl(stringBuilder.ToString()));
}

}
}

Use follwoing xml in Elements file of CustomAction element:



Id="XYZConfiguration"
Location="Microsoft.SharePoint.Administration.Applications"
Title="XYZ Configuration"
Sequence="100"
ImageUrl="/_layouts/images/CentralAdmin_Security_GeneralSecurity_32x32.png"
/>
Id="XYZConfiguration.AdminPage"
GroupId="XYZConfiguration"
Location="Microsoft.SharePoint.Administration.Applications"
Sequence="6"
Title="Configure XYZ Project"
Description="Use this to configure XYZ Project connection options"
UIVersion="4">


Ensure that the feature has Farm level scope:

Finally deploy the solution and go to CA and click on Application management. Notice the section for configuring XYZ project.

Enter and save database connection string and list name in the page.

Inside the timer job or any SharePoint code the above saved values can be retrieved as follows:

Connection con = Connection.Local;

string connectionString = con.ConnectionString;
string listName = con.ListName;

JS Link for SharePoint 2013 Web Parts–A Quick Functional Primer

JS Link is a new web part property in many SharePoint 2013 web parts.  It allows users and developers to create Client-Side Rendering (CSR) solutions within SharePoint 2013.  In other words, it allows alternate formatting, data and functionality to be manipulated within a web part.  It is one approach that will help replace the data view web part (DVWP) functionality that was used in SharePoint 2010 and SharePoint Designer 2010.

For example, CSR scenarios can edit how specific fields are displayed, how whole web parts are formatted and what functionality is available.  And these are just a few simple examples.  There is a lot of potential for what can be done.  My session at SPC12 just scratched the surface while others dug much deeper.

Something to note is that using JS Link to implement CSR functionality is easy and reversible.  If you don’t like what it’s doing to your web part you can easily change the JS Link property back (blank it out) and your web part will go back to it’s default format.

The CSR approach is more developer-focused than power user-focused.  There are, however, a few simple things that can be done that I think will be accessible to power-users that have some comfort level with code, specifically JavaScript, HTML and CSS.

So, here are the main components you need to make CSR work with out-of-box web parts – nothing fancy – using JS Link in SharePoint 2013:

  • Create a JavaScript override file
  • Upload the JavaScript file to the Master Page Gallery
    • Set the content type and properties of the file in the Master Page Gallery
  • Set the JS Link property of the web part to point to the JavaScript file

Sounds easy enough, but there are a few details to sort out to get everything synced up.  Additional details for each step are listed below:

Create the JavaScript file 
In these examples, JavaScript is being used to override different things – how data is displayed and what content is displayed.  For starters we’ll override a specific field in a view.

During my session at the SharePoint Conference (SPC12) I used a few simple examples that are a good starting point.  EXAMPLE JS FILES

In the first example, we get everything in place and make sure that it’s working.  We start with a standard view (AllItems) that shows text fields, and then use the JS Link functionality to override a single column – displaying different text than came with the view.  We are replacing whatever the ‘MoreText’ column contained with the word ‘Animal’.

image

As the notes in the sample script mention, the Fields override works specifically with individual fields.  You can specify a single field, or multiple fields.  For each field (column) override, you need to identify the field being overridden and the replacement value.

When identifying the field name, take note that you need to use the internal name for the column, which may not be the same name that is displayed.  In some cases this is true, but not all.  See my post on finding the internal column name.

The ‘View’ component of the command is in reference to the type of template being overridden – in our case the view.  There are also options for the NewItem, EditItem and DisplayItem forms, but we won’t cover them in this article.

The last piece of the command for each field is the override value for the field.  This can be a static value – as in the first example – a variable, or HTML and the value, allowing you to style the value.  You can also call a function within the script to do more complicated logic – such as conditional formatting – but for the field.

Note: The following example code is shown with the Before and After output of the sample web part.  The changes will not go into effect until you’ve put all the pieces in place – the steps which are listed after the sample images.

Example 1:  Uses a static value to override the field value.  ‘Animal’ will replace the ‘MoreText’ field value for each list item in the view.

image

Before:

image

After:

image

Example 2:  Displays the true value of the MoreText field, but formats it (bold) by wrapping it in an HTML tag.

image

Before:

image

After:

image

Example 3:  Calls a function that formats the value that overrides the field data.  In this case it uses a conditional to determine what data is displayed.  This could just as easily be used to implement conditional formatting for the field by keeping the field data as in Example 2, but formatting it differently using HTML tagging.

image

image

Before:

image

After:

image

Example 4:  Uses a different override.  This example uses the Item override instead of the Field override.  Using the Item completely overrides the web part and requires the Header and Footer overrides as well.  In the example here, the data is displayed in an HTML list where the open tag is in the header and the closing tag is in the footer.  Each item is then an item in the list.

image

image

Before:

image

After:

image

One other note on the code.  We aren’t getting into details with these settings, but a few of the sample scripts also include settings for BaseViewID and ListTemplateType.  These settings are not required, but if you are using JS Link on a page that has more than one view, these properties control which web parts are affected by the JavaScript code.

BaseViewID is the view ID for the list with 1 being the AllItems view.

ListTemplateType is the ID for the type of list template is used such as Links List, Task List, Custom List, etc.  A list of these types in 2013 can be found here: 
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.listtemplatetype(v=office.15).aspx

Upload it to the Master Page Gallery

The script files need to be uploaded to a place where they can be accessed by the web part.  Depending on what version of SharePoint you’re using and what your scope is, you will need to determine the best location for the scripts.  In our case we used Office 365 for a test bed and only want to use the scripts within our site collection, so we are uploading the files to the Master Page Gallery.

As each file is uploaded, the content type of the file will need to be changed to ‘JavaScript Display Template’ and the required fields will need to be completed.

In our examples, the Target Control Type is ‘View’.

The Standalone value is ‘Override’.

And the Target Scope is the relative URL of the site collection we’re customizing in the format: ‘/sites/d1’.

image

For our example, upload each of the 4 sample files so that you can see the different examples at work.

Add the JS Link property that points to the JS file

Finally, edit the web part properties you are trying to edit.  This may be web parts on a web part page, or a web part on a standard view page.  Edit the page, then the web part.  Expand the Miscellaneous section and edit the JS Link property using the following sample format to point to the location of the JavaScript file you are using for the CSR override:

~site/_catalogs/masterpage/csr_overridable_demo1.js

Save your changes.  If everything is working, the changes should be immediately visible.  If you still need to edit the JavaScript to match your specific column or example, edit the file using SharePoint Designer.

Edit the files using SharePoint Designer 2013

Developers have a number of code editing tools at their disposal and can use Visual Studio or others.  Non-developers can use SharePoint Designer 2013 to view and edit the JavaScript once it has been uploaded to the site.

If you haven’t already edited the files to match your specific list column names, start SharePoint Designer and open the site collection where you are doing your testing.

From SPD you can edit and save your JavaScript files live.  After you make a change to the JavaScript file, refresh the browser page and your changes should be reflected – assuming everything is correct.  Smile 

Wrap-up

Sorry for such a short and unpolished post – there is a LOT more to talk about regarding JS Link and SharePoint 2013 –  but I wanted to get this out for people that attended my #SPC064 session at #SPC12 or who started hearing the rumblings about JS Link this week while at the conference. Hopefully this allows you to get started playing around with the power of JS Link.

Lots more to come!

Notes:

  • JS Link is not only used in web parts, but can also be set and used when creating custom apps, etc.  This post is just covering the specific example when using the web part property.
  • Be sure to take a look at the HTML that is produced by the page once you have your CSR in place.  Some approaches in the CSR may not jive well with the existing page code. You  want to avoid conflicting tags, etc.
  • JS Link override will not work if the form has been edited in SPD

 

Source : http://www.idubbs.com/blog/2012/js-link-for-sharepoint-2013-web-partsa-quick-functional-primer/

SharePoint 2013 Search – How to Crawl Large External Data using BCS/WCF Service.

Scenario:

I had a hard time finding an end to end solution to this problem. We had to index external content using SharePoint search via BCS. There are plenty of blogs that described how to create an External Content Type, how to create a SharePoint WCF service, how to create a BCS Service, and how to use that connection to crawl content using SharePoint Search. The issue arose, where the number of rows returned went above some thresholds that SharePoint had when it comes to WCF Services. Say you have a data source that has millions of rows… How can you safely crawl such large data without:

  1. bringing the Search Server to a “crawl” (no pun intended).
  2. Putting undo stress on the SQL server and network lines for bringing such a large data over the wire.

More than likely you will run into error messages such as the following in the SharePoint Logs.

  • Timeout expired. BDC Runtime Object Model has throttled the response. The response from the service took more than ‘180000’ milliseconds. The limit can be changed via the “Set-SPBusinessDataCatalogThrottleConfig’ cmdlet.
  • WCF Service Connector has throttled the response. The response from the WCF service contains more than ‘3000000’ bytes. The maximum amount of data that can be read through WCF Service Connector is ‘3000000’ bytes. The limit can be changed via the ‘Set-SPBusinessDataCatalogThrottleConfig’ cmdlet.
  • Web Service Connector has throttled the response. The response from the web service contains more than ‘3000000’ bytes. The maximum amount of data that can be read through Web Service Connector is ‘3000000’ bytes. The limit can be changed via the ‘Set-SPBusinessDataCatalogThrottleConfig’ cmdlet.
  • Opening of a new connection is throttled. Maximum enabled connections ‘200’ for proxy are already been opened.
  • Database response throttled. Maximum number of rows that can be read through the database system utility is 2000.

There were some proposed solutions, such as increasing the default throttling by using a set of PowerShell commands. However, when it comes to large data, you’re still going to run into trouble.

Solution:

Implement Paging in your WCF service.

  1. Create a Method in WCF Service to call the database using some parameter to return row limits.
  2. Create a List Read Function for the WCF using SharePoint Designer.
  3. Set a Filter for that method in SharePoint Designer.
  4. Crawl.

Create a Method in WCF Service to call the database using some parameter to return row limits.

I will not get into the details of how to create a SharePoint WCF Service. We’re going to assume you know how to do that. We’re going to implement a method in the main WCF Service Class that returns IEnumerable of type “SPCrewData” and pass a parameter named PageNum.

 

In the above mentioned method, two things need to be handled:

       1.Get the total count of the items to be returns from sql.
       2. Page through by using that number to do a comparison against in SQL Query.

 

Get the total count of the items to be returns from sql.

    To return count simply use the select COUNT(*) function in sql. If your query is fairly simple then use something like this:

   

If you have a fairly complicated sql query then simply wrap that sql statement around your complicated query and also pass a ROWNUM column by using a ROW_NUMBER() sql function

   

Page through by using that number to do a comparison against in SQL Query

Here is the complete Code. 

//This method will page through items a 1000 at a time. 

public IEnumerable getAllItemsPaged(int PageNum)
{
List itemList = new List();
string SqlQueryTotalCountStr =
@"SELECT COUNT(*) AS TotalCount
FROM ( SELECT *
FROM Orders
WHERE OrderDate >= '1980-01-01'
) "
;
//return the total count of the results e.g. 35000
int count = 0;
try
{
using (SqlConnection conn = new SqlConnection(""))
{
using (SqlCommand sqlComm = new SqlCommand(SqlQueryTotalCountStr, conn))
{
try
{
conn.Open();
using (SqlDataReader r = sqlComm.ExecuteReader())
{
itemList = new List();
while (r.Read())
{
count = Convert.ToInt32(r["TotalCount"]);
}
}
}
catch
{
}
}
}
}
catch
{
}
//if rowNumb is <= TotalCount then perform this
if ((1000 * PageNum) <= count && count > 0)
{
//if rownum +1001 is greater than total count (e.g. 35000)
//then simply use totalcount - (rownum +1) as the upper limit.
//this matter during the tail end of the paging. The if else is there to handle the last set of
                ​//items to be indexed.   

int upperlimit = 0;
if ((1000 * PageNum) + 1001 >= count) upperlimit = count - ((1000 * PageNum) + 1);
else upperlimit = (1000 * PageNum) + 1001;
string SqlQueryStr = @"SELECT *
FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY OrderDate ) AS RowNum, *
FROM Orders
WHERE OrderDate >= '1980-01-01'
) AS RowConstrainedResult
WHERE RowNum >= " + ((1000 * RowNum) + 1) +"
AND RowNum < "+ upperlimit+"
ORDER BY RowNum"
;
try
{
using (SqlConnection conn = new SqlConnection(""))
{
using (SqlCommand sqlComm = new SqlCommand(SqlQueryStr, conn))
{
try
{
conn.Open();
using (SqlDataReader r = sqlComm.ExecuteReader())
{
itemList = new List();
while (r.Read())
{
SPCrewData itemObj = new SPCrewData();
itemObj.Author = r["Author"].ToString();
itemObj.BlogID = Convert.ToInt32(r["BlogId"].ToString());
itemObj.Description = r["Description"].ToString();
itemObj.Title = r["Title"].ToString();

itemList.Add(itemObj);
}
}
}
catch
{
}
finally
{
}
}//END USING
}//END USING
}
catch
{
}
finally
{
}
}
return itemList;

}

Set a Filter for that method in SharePoint Designer

   In SharePoint Designer, you will be Creating the External Content types, and mapping it to the WCF Service that you created. When It comes tocreating Operations for the service, right click in the Data Source Explorer in SharePoint Designer and select the “New Read List Operation”

 

 

  

 

Click Next where you will see the page displaying the Input Parameter

  

Click the “Click to Add” link which will take you to the “Filter Configuration” dialogue.

  

Select a “New Filter”

Choose Page Number as the filter type.

Choose “PageNum” as the Filter Field.

 

Here is what will happen. When Search calls this Method, it will call your method by initially passing a default PageNum value of 0. Your method will execute, and search will index those results. It will then call the method again, however, this time, it will increment the PageNum Value to 1, Execute, index, call method again, increment PageNum Value to 2, …etc,etc….

Click Finish.

Crawl

  • Create your Content Source in SharePoint Search Service Application as a Business Data Connectivity.      
  •      
  • Point it the WCF Service that you created .
  • Hit OK.                                                                                                    

      

     

  • Run a full crawl.
  • You should get all the items in the sql back end indexed via BCS.

 

Hope you found this blog useful.

Edit existing master page in SharePoint 2013

In SharePoint 2013 we can edit existing master page to hide top links and change logo. But before doing that we need to copy the existing master page and edit it. Following are the steps to edit the master page to change the logo and hide the top navigation links.

Download the master page (Seattle.master) from SharePoint site master page gallery.

Open it in any editor like SharePoint designer or Visual studio or note pad.

To remove the text “SharePoint” on the top left, check for the code below,

runat=”server” />


Delete or comment the code to remove “SharePoint” text.

To hide newsfeed, SkyDrive and Sites, Check for


Delete or comment the above code to remove or hide NewFeed, SkyDrive, Sites.

To hide Share, Follow and Sync check for


Delete or comment the above code.

To change the logo


Change the LogoImageUrl to the logo that we want to display in the site. The image url should be logo image.

Once done with the changes upload the master page in the master page gallery as “ASP NET Master Page” as content type. Publish the master page as a major version. Once done, set the master page as primary master page of the site.

Create or customize a content type

Content types enable site users to quickly create specialized kinds of content by using the New Item or New Document command in a list or library. Content types provide site owners a way to make sure that that content is consistent across sites. Site owners can pre-configure specific details about the content when they set up content types for a site, list, or library. To learn general information about the benefits of content types, seeIntroduction to content types and content type publishing.

IMPORTANT    To create site content types for a site, you must have Full Control for that site. To create site content types for the top-level site in a site collection, you must be a site collection administrator.

To create a site content type, follow these steps:

  1. Go to the site for which you want to create a site content type.
  2. Select the Options button Options button and then select Site Settings.
  3. Under Web Designer Galleries, choose Site content types.
    The Gallery shows all the existing site content types, grouped in categories. The one that you choose becomes the parent of your new content type. The new content type inherits the attributes of its parent.

    TIP    Note the name of the parent group, you will need it later.

Screenshot of the Site Contents Types page in the Web Designer Gallery of SharePoint 2013. This shows Parent status clearly

  1. Click Create to open the New Site Content Type page.

Screenshot of the Create dialog for a new Site Content Type in SharePoint 2013

  1. In the Name and Description section, type a name and a description for the new site content type.
  2. In the Select parent content type from list, select the name of the group that the parent content type belongs to.
  3. In the Parent Content Type list, select the name of the parent content type on which you want your own content type to be based.
  4. In the Group section, choose whether to store this new site content type inside an existing group or a new group.
  5. Click OK.

The Site Content Type Information page for your new content type appears. This page contains links to other pages where you can further customize the new site content type.

Top of Page TOP OF PAGE

In this article


Rename a content type

You can rename a site content type by changing its name in the gallery. To rename a site content type, follow these steps.

  1. Go to the home page of the site that contains the content type that you want to rename.
  2. Select the Options Settings button button, and then choose Site Settings.
  3. In the Web Designer Galleries group, select Site Content Types.
  4. On the Site Contents Types page, click the name of the content type that you want to change.
  5. On the Site Content Type Information page, under Settings, click Name, description, and group.
  6. In the Name text box of the Name and description section, change the name of the content type.
  7. When you finish, click OK.

Top of Page TOP OF PAGE

Associate a Word, Excel, or PowerPoint template with a content type

To make sure that documents are consistent, you can associate a Word, Excel, or PowerPoint template with a content type.

For example, you might want employees to use a standard Excel template when they create a weekly timesheet. If you associate the template with a Timesheet content type, every time someone uses the Timesheet content type, the correct template is automatically loaded in the worksheet.

You can make it even easier for users by adding the Timesheet content type to a library. Then, users can open the correct timesheet just by clicking Timesheet on the New Documents menu. To learn how to do this, see Add a content type to a list or library.

To associate a template with a content type, follow these steps.

  1. Go to the site for which you want to change a site content type.
  2. Select the Options button Options button and then select Site Settings.
  3. Under Web Designer Galleries, choose Site content types.
  4. Click the name of the content type that you want to change by associating a Word, Excel, or PowerPoint template.

NOTE   If names of the content types are not hyperlinks, it means that this site inherits its site content types from another site. To change the content type, you must move to that site.

  1. Under Settings, click Advanced settings.
  2. Enter the location of the template. If the template is stored on your site, click Enter the URL of an existing document template, and then type the URL for the template that you want to use.If the document template is stored on your local computer, click Upload a new document template, and then click Browse. In theChoose File dialog box, locate the file that you want to use, select it, and then click Open.
  3. In the Update Sites and Lists section, under Update all content types inheriting from this type?, click Yes if you want to update all content types that inherit from this content type with the document template.
  4. Click OK.

Top of Page TOP OF PAGE

Configure a content type to always display the Document Information Panel

The Document Information Panel is available for Word, Excel, and PowerPoint in Microsoft Office 2010 and in later versions. The Document Information Panel displays a form on documents of these types, and users can view or change metadata information in the panel. If the document is saved to SharePoint, they save the information directly from the Office program they use to edit the document.

The Document Information Panel displays text boxes in a form to collect metadata from users.

For example, suppose that you have a Sales Proposal content type that has a column for the company that the proposal addresses. When you display the Document Information Panel, users can enter the name of the company directly from the document while they edit it. If the company name has already been entered, the use can view the information or update it. When the document is saved to the server, this property is automatically updated in the Company column for the library.

To configure settings for the Document Information Panel for a content type, follow these steps.

  1. Go to the site for which you want to change a site content type.
  2. Select the Options button Options button and then select Site Settings.
  3. Under Web Designer Galleries, choose Site content types.
  4. Click the name of the site content type that you want to change.

NOTE   If names of the content type that appear are not hyperlinks, then it means that this site inherits its site content types from another site. The site content type must be updated on that site.

  1. Under Settings, click Document Information Panel settings.
  2. In the Document Information Panel Template section, do one of the following:
    • To use a default template that displays the properties (columns) that were defined for the content type, clickUse the default template for Microsoft Office applications.
    • To use an existing custom template, click Use existing custom template (URL, UNC, or URN), and then type the path of the location of the template.
    • To upload an existing custom template (XSN), click Upload an existing custom template (XSN) to use, and then click Browse to locate the template that you want to use.
    • To create a custom panel in InfoPath, click Create a new custom template.

NOTE   If you select this option, InfoPath starts and displays the default template, which you can customize to create a custom panel.

  1. In the Show Always section, specify whether you want this Document Information Panel to display automatically when documents of this content type are first opened or saved.
  2. Click OK.

Introduction to System Status Notifications in SharePoint 2013

SharePoint 2013 implements new System Status Notifications designed to provide site users information about lifecycle events to include availability of upgrade, maintenance, and read-only states.

System Status Notifications present important information about a SharePoint deployment and its availability, whether during upgrades, routine maintenance,  or conversion to read-only. Users are kept “in the know” as they receive a prominent banner on their sites that provides insight into the activity being performed—helping reduce calls to the help desk and subsequent burden on IT.

Farm administrators and developers can configure System Status Notifications to provide additional information to users and adjust upgrade delays.

SPWebApplication Properties

UpgradeReminderDelay

The UpgradeReminderDelay property is used to enable users to suppress the upgrade availability System Status Notification for a specified period of time.  Farm administrators can configure theUpgradeReminderDelay to allow users to suppress the UpgradeAvailable reminder for a period of time or alternatively set the value to 0 which shows users an UpgradeRequired reminder.  The default value is 30 (days).

image

Figure 1 above illustrates the System Status Notification when the UpgradeReminderDelay is set to a value greater than 0.

image

Figure 2 above illustrates the System Status Notification when the UpgradeReminderDelay is set to 0.

Configuring the UpgradeReminderDelay SPWebApplication property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            SPWebApplication webApp = SPWebApplication.Lookup(new Uri(“http://sharepoint.contoso.com”)); 
            webApp.UpgradeReminderDelay = 90; 
            webApp.Update(); 
        } 
    } 
}

Windows PowerShell

$webApp = Get-SPWebApplication http://sharepoint.contoso.com

$webApp.UpgradeReminderDelay = 90

$weApp.Update()

UpgradeMaintenanceLink

The UpgradeMaintenanceLink property is used to provide users additional information during the site collection upgrade process.  Farm administrators can use the UpgradeMaintenanceLink property to enable a More Information link in the System Status Notification during the upgrade process directing users to a location where more information is available related to the upgrade process.  The default value for theUpgradeMaintenanceLink property is null therefore no More Information link is displayed to users.

image

Figure 3 Illustrates the System Status Notification when the UpgradeMaintenanceLink is not null.

Configuring the UpgradeMaintenanceLink SPWebApplication property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
     class Program 
     { 
         static void Main(string[] args) 
         { 
             SPWebApplication webApp = SPWebApplication.Lookup(new Uri(“http://sharepoint.contoso.com”)); 
             webApp.UpgradeMaintenanceLink = “http://office.microsoft.com/en-us/sharepoint-help/training-courses-for-sharepoint-2013-HA104030990.aspx“; 
             webApp.Update(); 
         } 
     } 
}

Windows PowerShell

$webApp = Get-SPWebApplication http://sharepoint.contoso.com

$webApp.UpgradeMaintenanceLink =  “http://office.microsoft.com/en-us/sharepoint-help/training-courses-for-sharepoint-2013-HA104030990.aspx”

$webApp.Update()

ReadOnlyMaintenanceLink

The ReadOnlyMaintenanceLink property is used to provide users additional information when a site collection is set to read-only or a content database is configured to read-only in Microsoft SQL Server.  Farm administrators can use the ReadOnlyMaintenanceLink property to enable a More information link in the System Status Notification while a site collection or content database is in a read-only state.  The default value for the ReadOnlyMaintenanceLink is null therefore no More Information link is displayed to users.  For example, if a farm administrator would like to provide additional information on the read-only experience for users, the ReadOnlyMaintenanceLink can be configured with a More information link that directs users tohttp://technet.microsoft.com/en-us/library/dd793608.aspx#proc1.

image

Figure 4 Illustrates the System Status Notification when the ReadOnly property for a SPSite is set to $true.

image

Figure 5 Illustrates the System Status Notification when the content database for a SPSite is set to read-only.

Configuring the ReadOnlyMaintenanceLink SPWebApplication property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
    class Program 
     { 
         static void Main(string[] args) 
         { 
             SPWebApplication webApp = SPWebApplication.Lookup(new Uri(“http://sharepoint.contoso.com”)); 
             webApp.ReadOnlyMaintenanceLink = “http://technet.microsoft.com/en-us/library/dd793608.aspx#proc1“; 
             webApp.Update(); 
         } 
     } 
}

Windows PowerShell

$webApp = Get-SPWebApplication http://sharepoint.contoso.com

$webApp.ReadOnlyMaintenanceLink = “http://technet.microsoft.com/en-us/library/dd793608.aspx#proc1”;

$webApp.Update()

NOTE

If a site collection or content database is set to read-only, the read-only message is displayed, upgrade status notifications are not displayed.  If ReadOnlyMaintenanceLink is not empty, a More Information link will be displayed.

If a site collection or content database is not read-only, and an upgrade is processing, “the site is currently being upgraded” is displayed.  If UpgradeMaintenanceLink is not empty, a More Information link will be displayed.

If a site collection or content database is not read-only, not upgrading, and the site is in 2010 mode, and current user is site collection admin:

  • If SPWebApplication.UpgradeReminderDelay is greater than 0, “upgrade is available” notification will be displayed. Clicking on the “remind me later” will update the SPSite.UpgradeReminderDate to be in n days, and dismiss the notification.
  • When SPWebApplication.UpgradeReminderDelay is 0, site admin will see “upgrade is required” notification. There will be no “remind me later” option. The notification will be displayed on every browse, and have to be manually dismissed each time.

 

UpgradeEvalSitesRetentionDays

The UpgradeEvalSitesRetentionDays SPWebApplication property is used to specify the default number days after which upgrade evaluation sites will be deleted. The expiration date for upgrade evaluation sites is set based on their creation date plus this value in days.  For example, in the event a site collection administrator requests an evaluation site collection, and that site collection is created on 4/16/2013, the evaluation site collection will be deleted on 5/16/2013 (the default value is 30 days).

image

Figure 6 Illustrates the System Status Notification when the UpgradeEvalSitesRetentionDays is set.

Configuring the UpgradeEvalSitesRetentionDays SPWebApplication property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
    class Program 
     { 
         static void Main(string[] args) 
         { 
             SPWebApplication webApp = SPWebApplication.Lookup(new Uri(“http://sharepoint.contoso.com”)); 
             webApp.UpgradeEvalSitesRetentionDays = 90; 
             webApp.Update(); 
         } 
     } 
}

Windows PowerShell

$webApp = Get-SPWebApplication http://sharepoint.contoso.com

$webApp.UpgradeEvalSitesRetentionDays = 90;

$webApp.Update()

SPSiteUpgradeThrottleSettings

This class stores the throttle settings for large site upgrade, for example, a farm administrator can throttle the upgrade of site collections with a specified number of sites.

See also SPSiteUpgradeThrottleSettings members (Microsoft.SharePoint.

SPSite Properties

UpgradeReminderDate

The UpgradeReminderDate SPSite property is used to specify a date after which site collection administrators will be reminded to upgrade the site collection.

Configuring the UpgradeReminderDate SPSite property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            SPSite site = new SPSite(“http://sharepoint.contoso.com”);

            System.DateTime today = System.DateTime.Now; 
            System.TimeSpan duration = new System.TimeSpan(30, 0, 0, 0);

            site.UpgradeReminderDate.Add(duration); 
        } 
    } 
}

Windows PowerShell

$site = Get-SPSite http://sharepoint.contoso.com

$today = Get-Date

$duration = $today.AddDays(30)

$site.UpgradeReminderDate.Add($duration)

ExtendUpgradeReminderDate

The ExtendUpgradeReminderDate SPSite property is used to extend the upgrade reminder date for a site collection by the days specified at UpgradeReminderDate.  When called, it addsSPWebApplication.UpgradeReminderDelay to the current time, stores it in SPSite.UpgradeReminderDelay.

Configuring the ExtendUpgradeReminderDate SPSite property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            SPSite site = new SPSite(“http://sharepoint.contoso.com”); 
            site.ExtendUpgradeReminderDate(); 
        } 
    } 
}

Windows PowerShell

$site = Get-SPSite http://sharepoint.contoso.com

$site.ExtendUpgradeReminderDate()

More Information 

System Status Notifications are rendered through sending JavaScript to the page head and do not implement server-side controls.  The ExtendUpgradeReminderDate is implemented as an xmlHttp object that sends a REST call to web.Url/_api/Site/ExtendUpgradeReminderDate.

AllowSelfServiceUpgrade

The AllowSelfServiceUpgrade SPSite property is used to specify whether version to version upgrade is allowed on a site collection.  If the AllowSelfServiceUpgrade property is set to false site collection administrators will not be able to upgrade their site collection, if set to true, site collection administrators can perform a self-service (Deferred Site Collection Upgrade).  Farm administrators can control the upgrade process either en masse or selectively by disabling self-service upgrade.

image

Figure 7 illustrates configuring the AllowSelfServiceUpgrade SPSite property to $false.

Configuring the AllowSelfServiceUpgrade SPSite property:

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Microsoft.SharePoint; 
using Microsoft.SharePoint.Administration;

namespace Sample_Maintenance_Link_Code 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            SPSite site = new SPSite(“http://sharepoint.contoso.com”); 
            site.AllowSelfServiceUpgrade = false; 
        } 
    } 
}

Windows PowerShell

$site = Get-SPSite http://sharepoint.contoso.com

$site.AllowSelfServiceUpgrade = $false;

Summary

A completely revised, backward-compatible upgrade experience is designed to balance the needs of users with those of IT. Because changing software is often difficult, SharePoint Server 2013 enables IT to upgrade SharePoint Server 2010 without having to upgrade users’ sites and content. These upgrades are deferred to the users, allowing them to choose when the time is right.

New evaluation site collections allow users to request an evaluation of the upgrade prior to upgrading production content; if satisfied with the experience, site collection administrators then can upgrade their content. It’s important to note that whether you have deployed SharePoint Server 2010 on-premises or subscribe to SharePoint Online in Office 365, the full upgrade capability is available.

New SharePoint 2013 authentication process and Test Lab Guide overview videos

The following new conceptual videos that describe SharePoint 2013 authentication processes are now available:

These videos step you through the details of claims-based authentication for user access to a secure SharePoint resource.

Additionally, the following Test Lab Guide (TLG) overview videos are available:

These videos show you the stack (the set of TLGs that you need to configure) and the lab build-out, correlated with the steps in the TLG. The idea is to give you an idea of what’s involved in building a given test lab in a short, to-the-point, and visually interesting way. You can then decide whether to take the plunge and make it happen in your test lab. For more information about TLGs, see the Test Lab Guides portal page.

If you have any suggestions about to improve these types of videos, please let us know by leaving a comment on this blog post.

For additional videos for SharePoint 2013, see Video demos and training for SharePoint 2013.

SharePoint 2013 – The new “Preview Feature” in Search Results

In SharePoint 2013 Search has an Incredible new feature where for each search result that gets displayed on the search results page users can now “Hover Over” the result to view a Preview box for that Item.

Here is the quick Screen about the “Hover Panel” or the Preview box.

Some of the Features of this Hover Panel dialog box are –

* Hover panel has a high-fidelity Web Application Viewer or Preview that is available for all Office documents saved to SharePoint. These Interactive previews are big enough to give you a idea of the structure, contents, and styling of the document you’re hovering over.

* The hover panel contains rich metadata that enables users to investigate a result more thoroughly, without having to click through and load the document. See “Last Modified” and “Contributors include” in the above screen.

* In addition to the Metadata it also displays Section headings and slide titles that are inside of a document, under the heading “Take a look inside. These are called “deep links” and you can see them in the above hover panel. These headings and titles are links—clicking through will take you directly to that section (or slide) in the document.

* The bottom of the hover panel contains a list of actions that may be performed on a result. Now you can follow the document, Edit the document, View the document’s library, View duplicates, and\or send the document in an email message right from the results page. These actions are also completely customizable, so your results can be more actionable.

CREATING A CUSTOM PAGE LAYOUT IN SHAREPOINT 2013

This article explains how to create custom page layouts in SharePoint 2013.  For more information on the SharePoint 2013 page model,see this Microsoft article.

Planning Out Your Page Layout

For this example, we’re going to recreate a chunk of a page on our web site (www.navantis.com):

image

In our previous article, we created Master Page that defined the header, footer and global style sheets for this page.  Now we’re going to create a page layout that follows this basic format.  The content will be dynamic so that you could create as many pages as you like based on this layout. 

In our page layout, we’re going to define the following areas as “field controls”.  We’re going to create them all in a single content container and lay them out explicitly in order to reflect our design:

image

The breadcrumb on the top left we can use SharePoint’s breadcrumb trail and we will embed the newsletter subscription into the page layout because we don’t want this to be explicitly defined into the layout.

Defining Your Content Type

So before we do the HTML work, let’s create a content type (a definition for content fields) that defines each of these fields for our page.  Based on the above plan, we need the following fields:

  • LargeHeadline
  • RightHandBlurb
  • LeftLinkList
  • LeftColumnTitle
  • LeftColumnText
  • RightColumnText

In each case, these will be HTML controls.  SharePoint 2013 allows you to define other types of content for these fields such as images.  Images in SharePoint 2013 can be rendered in specific dimensions and SharePoint 2013 will dynamic render any image to that specified to ensure they fit nicely into your defined layout.

To create a content type, go to Site Settings –> Site Content Types (under Web Designer Galleries).  If you look at Page Layout Content Types you will see existing ones for Article, Catalog, Welcome Page, etc.  We’re going to create a content type for our layout.  Click on Create and type in a name for your new content type:

Under Parent Content Type, you can select the parent your content type will inherit from.  If you look at the existing page layout content types, they inherit from the content type Page.  Page is in the group Publishing Content Types.  You can also specify the group you want to place your new content type – you could add it to the existing Page Layout Content Types group or create your own custom group.

image

When you have created your new content type, SharePoint 2013 will display the columns that were inherited automatically from the Page content type.  Lets add some new ones to represent our custom fields.  Click on the Add from new site column and let’s add each field:

image

For each column, we can specify the type.  For those fields we want to explicitly style, we can use the Single Line of Text option to have the content author put in plain text that will be formatted by the template.  For those fields that we want to provide more control to the content author, we can specify the field as Full HTML content and then content author will be able to put in any HTML using the rich text editor.    For our fields, let’s use this approach:

  • LargeHeadline – Single line of text
  • RightHandBlurb – Multiple lines of text
  • LeftLinkList – Full HTML
  • LeftColumnTitle – Single line of text
  • LeftColumnText – Full HTML
  • RightColumnText – Full HTML

image

For each field, create a site column.

Now we have fields to store the content, let’s now create a Page Layout.

Creating a Page Layout

To create a page layout, go to the Design Manager and Click on 6. Edit Page Layouts.  Click on Create a Page Layout.  Give your page layout a name, pick your master page and your content type you just created.

image

If you preview your page layout, you will see it doesn’t look like much – we need to update the HTML around the field controls to properly format the layout.

Publishing Your Page Layout

Before you can use your page layout, it has to be published.  To publish your page layout, go to Site Settings –> Master pages and page layouts.  You will see two files – one is HTML and one is ASPX.  in SharePoint 2013, the HTML is now the master and you can edit it using an HTML editor.  SharePoint 2013 then generates the ASPX file automatically.  To publish your layout, click on the HTML file and then Publish:

image

This will publish both the HTML and ASPX files, now making them available to create a page based on your layout.

Creating a Page

To create a page based on our new layout, go to New Page. 

image

If you then go to Page –> Page Layouts you will find our new Page Layout in the list of available Page Layouts.  When you switch the page layout, you should now see all the fields that we created earlier in our content type.

You can fill in your content either by typing it in or copying and pasting it from either your existing web site or from office documents such as Word.  The copy and paste has improved dramatically over previous versions!

Here is my content now filled out:

image

Now we can publish our page…

image

Our content is there, but the layout doesn’t reflect what we want…so now edit the HTML to update our layout.

Customizing Page Layouts

Page layouts in SharePoint 2013 are just HTML files with a lot of additional markup to specify where the controls are going to be injected.  We can now customize the HTML file through the design manager.  You can simply grab a copy of the HTML file, make your changes and re-upload your file and SharePoint 2013 will do the rest.  There are two ways to grab the file:

  • Go to Design Manager –> 3. Upload Design Files and map a network drive to your master page directory.
  • Go to Site Settings –> Master pages and page layouts and you can download your file.

After iterating a few times with the page layout and moving the snippets provided by SharePoint 2013 into the appropriate spots, we now have a nicely formatted page:

image

All the content within the main page area is fully managed by SharePoint can be easily changed by a content author.

image

CREATING A NEW MASTER PAGE IN SHAREPOINT 2013

This article explains how to create a Master Page in SharePoint 2013 from an existing HTML page with associated graphics, scripts, CSS files, etc.  This article is targeted primarily at designers who want to start customizing their SharePoint 2013 site with minimal fuss.  In SharePoint 2013, designers can now use HTML, CSS and JavaScript to create dynamic pages where in previous versions it required an ASP.NET developer.  This article shows a step by step example.

For this example, I have used our own web site as a starting point: 

http://www.navantis.com/Portals_Collaboration.html

image

We’re going to convert this page into a master page for use in SharePoint 2013.

Planning Out Your Master Page

A Master Page in SharePoint represents the chrome elements of a page, e.g. those areas of the site that stay the same from page to page and the associated master styles, scripts, fonts, images, etc. that should be included on every page of your site. 

For our page, we want these chunks of content in our master page as well as all the governing style sheets, JavaScript, images, etc.:

image

image

The content in the middle of the page is what will governed dynamically by SharePoint using a combination of Page Layouts and dynamic content.

Before moving to SharePoint, create a stripped down HTML file that has the chrome isolated with the appropriate images, CSS, JavaScript, etc. in folders.

image

The dynamic content is going to go where it says, “Dynamic content will go here”.  My folder structure looks like this:

image

Ok, now that we’re organized, we can create our Master Page in SharePoint 2013.

Creating a SharePoint 2013 Account

Currently, you can download and install the SharePoint 2013 beta software locally, or you can create a cloud based account.  I have used the cloud based account route because its easy and free for the moment.  Go to http://www.microsoft.com/office/preview/en/office-365-enterprise to signup for an account and you will have your own SharePoint 2013 environment in the cloud.

The same instructions should work on a local version of SharePoint 2013 as well.

Creating a Publishing Site Collection

When you are first granted a SharePoint 2013 account, you are allocated a public facing web site and a collaboration site.  You can use your public facing web site, but I recommend you create a separate Publishing Site Collection for development purposes as Microsoft only allows one public facing web site in the current cloud environment.  To create a new Publishing Site Collection, go to Admin –> SharePoint –> Site Collections and click on the New Private Site Collection button. 

image

Now that you have a Publishing Site, you can start to customize it with your new Master Page.  Your default home page will look like this:

image

The Design Manager

If you click on “Design your site”, this will bring you to SharePoint 2013’s new Design Manager:

image

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

image

Mapping to the Master Page Directory

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

image

We’re going to Convert an HTML file to a SharePoint master page.  Click on that link and you will see this dialogue box:

image

This directory is the folder containing Master Page and Page Layouts as well as their dependent assets (CSS files, scripts, images, etc.).  The easiest way to manage this folder is to map a network drive in Windows to this folder.  To do this go to Windows Explorer, right click on your computer and select Map Network Drive.  Copy and paste the URL for the location of this directory (it’s at the top of this dialogue box) and put in your login credentials.  You should then get a drive letter that maps to this folder and you can copy and paste files from your local machine into SharePoint directly.

NOTE: You will get an error when you map the network drive if you don’t have the “Keep me signed in” checkbox selected when you sign into Office 2013.  Sign out, delete your cookies, and re-authenticate with this box checked and it will work.

image

With a mapped network drive, we can simply copy our template and dependent files into this folder. 

NOTE: SharePoint 2013 will allow you to create folders in this directory, so this might help in keeping organized to create a separate folder as the root of your master page and its files.

NOTE: If you cannot map the drive, you can also upload files through the UI by going to Site Settings and Clicking on  Master pages and page layouts.

image

When you click on this you will access the same master page library that is used by the Design Manager.

image

If you click on files you can then upload documents and create folders through the browser UI.

Creating a Master Page from HTML

Now that we have uploaded our files, we’re going to create a Master Page.  SharePoint 2013 can take your HTML file and convert it into a ASP.NET Master Page automatically.  When it does this, it will link the HTML and Master Page together so that if you change your 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.

image

Select your HTML file and click insert. 

If you go to the Design Manager, you will also now see your Master Page in the list of Master Pages:

image

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.

If you click on the Master Page, it will take you to a preview 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…We’re going to now move that place holder into where we want it to replace our dummy text in the middle of the page.

Download the HTML file from the SharePoint 2013 environment (you can just copy and paste it if you have a mapped network drive) and open it in your HTML editor and you will see that SharePoint 2013 has decorated your HTML with a number of tags.  These tags are used by SharePoint 2013 as markup to specify where to put to insert content when it generates the Master Page.  You can edit and add HTML around them and add new snippets to the HTML to add dynamic navigation, content containers, metadata etc. 

In your newly improved HTML file, you will see tags in the header (used to insert metadata, title and other header information), at the top of the body (used to insert the ribbon), and at the bottom you will find a div called “ContentPlaceHolderMain”. 

This is a content place holder and is used by the Page Layout to inject content dynamically.  You can move this place holder into the appropriate spot in your HTML to insert the content correctly.

image

Publishing Your Master Page

The last step is we need to publish our master page – its currently in draft.  If you don’t publish it you won’t see it in the Site Master Page Settings drop down menu.  To publish your page, go to Site Settings –> Master pages and page layouts and then find your HTML file.  Hit the publish button on the ribbon. 

NOTE: If you try to publish the master page itself you will get an error because it is linked to the master HTML file.  If you publish the HTML file, the master page is automatically published as well.

Assigning Your Master Page to your Site

Now that your master page is published, you can assign it to your site.  All pages in your site will adopt this new chrome.  Publish sites have two types of pages: 1) publishing pages and 2) system pages.  Publishing pages are traditional web pages and System pages are views of lists, document libraries and other administrative pages.  You can assign your master page to either type of pages.

To assign your master page, go to Site Settings –> Master Page (under Look and Feel) and select your master page from the drop down list (if its not there then you probably didn’t publish it successfully or it has errors).  Your site will now adopt your new look and feel!

Here is my default site with the Master Page site assigned.

image

« Older Entries