Wednesday, 29 April 2015

Create a Custom Page Layout in SharePoint 2013

This is a Step-by-Step tutorial on how to Create a Custom Page Layout in SharePoint 2013.We will use the new Design Manager to Create a Layout (from an existing one) and then edit it in one of the editors like Notepad.Once the layout is Created and Uploaded to Master Page Gallery, you can edit the generated html file in an editor of your choice and upload it back to the Master Page Gallery.

Before you begin make sure that you have Publishing Feature enabled on your site and you see “Deisgn Manager” under Look and feel.


  1. Navigate to Site Settings -> Design Manager (under look and feel).
  2. Next in Design Manager select “6. Edit Page Layouts” and then “Create a page layout”
  3. Now Create a Custom Page layout using the Article Page Content type.
  4. When the Layout is Created, it gets available in “Edit Page Layouts” list and the “Master Page gallery” of the site.The Layout Page will be in Drafts mode until you publish it as a major version.
  5. Next Edit the New Layout Page and save the Changes.In SharePoint 2013 for every Layout page two files – .aspx and html are created by default.

    For making Changes to the Custom Layout, you need to download the html file of your layout page and make Changes to it.The modified html file is then saved back to the MasterPage Page gallery where the corresponding .aspx file gets updated automatically.
  6. Once you have updated and saved the Layout page, you need to Publish the Layout page as a major version to make it available in Layouts list.
  7. Finally, Create a new Page with your Custom Layout.

Tuesday, 28 April 2015

How to get ULS Logs in SharePoint 2013 (Developer Dashboard)

If you are a SharePoint developer and have ran around SharePoint Admin teams for ULS Logs here is a quick solution for you. You can get the ULS Logs right from the server for any page that you ran through in Developer Dashboard.

Prerequisites – You need to Activate Developer Dashboard using the following Stsadm command.

stsadm -o setproperty -pn developer-dashboard -pv on

Once you have turned ON the developer dashboard you can open it using a small icon next to “Focus on Content”



Once the Developer Dashboard is Open, refresh the SharePoint site page and it will appear in the developer dashboard.



Click on the “ULS Logs” tabs and you will see the fetching message.

Once its done the ULS tab will be displayed with the Logs from the server.

How to set a page as Home Page in SharePoint 2013 site

In this post we will look at options to set a Custom Page as Home Page in SharePoint 2013 site.

Option 1: If you want to set a Custom Page as a Home Page in a typical SharePoint Team site, you can simply do that by Opening the Page and selecting Page tab in ribbon -> Make HomePage button to set this particular page as default Home Page for your site.

Option 2: Another option to set a Custom Page as Home Page in SharePoint 2013 Team site is by using SharePoint Designer 2013. If you have opened or created a Page in SharePoint Designer then you can right click on the page and select the option “Set as Home Page” to set it as a default home page of your SharePoint site.

Option 3: If you are using the Publishing site (or site with publishing feature enabled), you can simply use the old “Welcome Page” link in the Site settings to set the URL of a page this is the desired home page for your SharePoint site.

How to Add\Embed Video to SharePoint 2013 site page

In this post we will look at how to Add or Embed these videos on SharePoint 2013 page.

You can either use the default Video view page that you get when you add the video to SharePoint or you can use the Video embed code to add the video in SharePoint 2013 page.In this post we will look at where to add the embed code.

  1. Create Asset library in SharePoint and upload a Video in it
  2. Navigate to the site library where you added the video and click on video thumbnail.In the view Video page click on the code icon and open embed code page.
  3. Copy the embed code
  4. Now go to the sharepoint page where you display a video
  5. Click on Insert tab to Insert “Script Editor” Webpart.
  6. Next click on Embed Code in Insert Ribbon tab and add the copied Video code to it.


Done.!!

Ref: http://www.learningsharepoint.com/2012/08/05/how-to-add-a-video-to-sharepoint-2013-site/
http://www.learningsharepoint.com/2012/08/05/addembed-video-to-sharepoint-2013-site-page/

How to add a Youtube video in Sharepoint 2013

In SharePoint 2013 admins can now Insert an iframe element into an HTML field like Content editor webpat on a page. This will let users Embed dynamic content from other sites, such as videos or map directions on any SharePoint site page.

Any external domains that will be Inserted in Iframe should be added as approved domains in “HTML Field Security”. By default, certain trusted external domains are already approved for use in iframes.Site collection administrators can customize the field security settings by changing the default trusted external domains.

To add a Youtube Video add the “Youtube.com” Domain in “HTML Field Security” first. Lets look at the Steps-

  1. Navigate to Site Settings (top-level Site collection) -> HTML Field Security.
  2. Make sure the domain “Youtube.com” is added as permitted domain
  3. Navigate to your Youtube video and click on Share and then Embed. Copy the code from youtube
  4. Add a Content editor webpart on a page and then click on “Edit Source” in “Format Text” tab in Ribbon. Add copied code in the source
  5. Click Ok


Done.!!!

Add Metadata navigation in SharePoint 2013

Metadata Navigation is one of the most useful features that was introduced in SharePoint 2010.By enabling this feature, users can Filter or narrow down the display of Documents within a document Library.The feature is highly beneficial while working with Document Libraries that has large number of documents.

Filtering documents by a Category or by a Metadata column can add a great value for efficient collaboration by the Team.Like the earlier SharePoint version, In SharePoint 2013, when enabled, the Metadata Navigation is added to the quick launch with the pre-Configured Navigation Hierarchies and Key Filters.

Lets look at the detailed Steps to Configure Metadata Navigation for a Document Library in SharePoint 2013.

  1. Enable “Metadata Navigation and Filtering” Site Feature in Site Settings
  2. Next Navigate to the Document Library Setting and select “Metadata navigation settings”.
  3. In the Metadata Settings select the Column that you want to Filter the Documents on.You need to add this Column to the Document Library first.
  4. Once you save the settings, a Filter Option appears in Quick Launch bar.

Tuesday, 21 April 2015

Verticle tile using promotion list in SharePoint 2013

We have seen in my earlier post. on how to create tiles menu in SharePoint 2013.

But what if you want these tiles in vertical order. There are two ways to achieve this. The one using jquery and other using CSS.

jQuery Solution

<script type=“text/javascript” src=“http://code.jquery.com/jquery-1.10.2.min.js “></script>
<script type=“text/javascript”>
$(document).ready(function () {
// Update this value to the number of links you want to show per row
var numberOfLinksPerRow = 4;

// local variables
var pre = “<tr><td><div class=’ms-promlink-body’ id=’promlink_row_”;
var post = “‘></div></td></tr>”;
var numberOfLinksInCurrentRow = numberOfLinksPerRow;
var currentRow = 1

// find the number of promoted links we’re displaying
var numberOfPromotedLinks = $(‘.ms-promlink-body > .ms-tileview-tile-root’).length;

// if we have more links then we want in a row, let’s continue
if (numberOfPromotedLinks > numberOfLinksPerRow) {

// we don’t need the header anymore, no cycling through links
$(‘.ms-promlink-root > .ms-promlink-header’).empty();

// let’s iterate through all the links after the maximum displayed link
for (i = numberOfLinksPerRow + 1; i <= numberOfPromotedLinks; i++) {

// if we’re reached the maximum number of links to show per row, add a new row
// this happens the first time, with the values set initially
if (numberOfLinksInCurrentRow == numberOfLinksPerRow) {

// i just want the 2nd row to
currentRow++;

// create a new row of links
$(‘.ms-promlink-root > table > tbody:last’).append(pre + currentRow + post);

// reset the number of links for the current row
numberOfLinksInCurrentRow = 0}

// move the Nth (numberOfLinksPerRow + 1) div to the current table row
 $(‘#promlink_row_’ + currentRow).append($(‘.ms-promlink-body > .ms-tileview-tile-root:eq(‘ + (numberOfLinksPerRow) + ‘)’));

// increment the number of links in the current row
numberOfLinksInCurrentRow++; Â }
}
});
</script>

This uses the CDN at jquery.com, so if your server does not have internet access you will need to copy this file locally.
Note that you can set the number of columns to wrap the quick links. This is the major advantage of using the jQuery script over the CSS.

The CSS

.ms-promlink-header{
display:none;
}

.ms-promlink-body{
width: 100%;
}

Nice and simple. Great for a one column left or right nav.

Ref:  http://dellakin-smith.com/vertical-promoted-links/



How to add tiles on SharePoint site?


SharePoint 2013 gives this option out of box.If you want to create the tile menu. You should use these steps:
  1. Create a promotion list. Go to Site Content -> Add an app -> Choose Promotion Link list -> pick a name and create this list.
  2. Go to the list just created and add the tiles you want to show with title, description, link, background image...
  3. Go to the landing page you want to show the tile menu on: Edit page -> Insert this list to the page and Save.
So you will see the tile menu display on the landing page.

Monday, 20 April 2015

DateTime.ToString() Patterns


All the patterns:

0 MM/dd/yyyy 08/22/2006
1 dddd, dd MMMM yyyy Tuesday, 22 August 2006
2 dddd, dd MMMM yyyy HH:mm Tuesday, 22 August 2006 06:30
3 dddd, dd MMMM yyyy hh:mm tt Tuesday, 22 August 2006 06:30 AM
4 dddd, dd MMMM yyyy H:mm Tuesday, 22 August 2006 6:30
5 dddd, dd MMMM yyyy h:mm tt Tuesday, 22 August 2006 6:30 AM
6 dddd, dd MMMM yyyy HH:mm:ss Tuesday, 22 August 2006 06:30:07
7 MM/dd/yyyy HH:mm 08/22/2006 06:30
8 MM/dd/yyyy hh:mm tt 08/22/2006 06:30 AM
9 MM/dd/yyyy H:mm 08/22/2006 6:30
10 MM/dd/yyyy h:mm tt 08/22/2006 6:30 AM
10 MM/dd/yyyy h:mm tt 08/22/2006 6:30 AM
10 MM/dd/yyyy h:mm tt 08/22/2006 6:30 AM
11 MM/dd/yyyy HH:mm:ss 08/22/2006 06:30:07
12 MMMM dd August 22
13 MMMM dd August 22
14 yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK 2006-08-22T06:30:07.7199222-04:00
15 yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK 2006-08-22T06:30:07.7199222-04:00
16 ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Tue, 22 Aug 2006 06:30:07 GMT
17 ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Tue, 22 Aug 2006 06:30:07 GMT
18 yyyy'-'MM'-'dd'T'HH':'mm':'ss 2006-08-22T06:30:07
19 HH:mm 06:30
20 hh:mm tt 06:30 AM
21 H:mm 6:30
22 h:mm tt 6:30 AM
23 HH:mm:ss 06:30:07
24 yyyy'-'MM'-'dd HH':'mm':'ss'Z' 2006-08-22 06:30:07Z
25 dddd, dd MMMM yyyy HH:mm:ss Tuesday, 22 August 2006 06:30:07
26 yyyy MMMM 2006 August
27 yyyy MMMM 2006 August


The patterns for DateTime.ToString ( 'd' ) :

0 MM/dd/yyyy 08/22/2006


The patterns for DateTime.ToString ( 'D' ) :

0 dddd, dd MMMM yyyy Tuesday, 22 August 2006


The patterns for DateTime.ToString ( 'f' ) :

0 dddd, dd MMMM yyyy HH:mm Tuesday, 22 August 2006 06:30
1 dddd, dd MMMM yyyy hh:mm tt Tuesday, 22 August 2006 06:30 AM
2 dddd, dd MMMM yyyy H:mm Tuesday, 22 August 2006 6:30
3 dddd, dd MMMM yyyy h:mm tt Tuesday, 22 August 2006 6:30 AM


The patterns for DateTime.ToString ( 'F' ) :

0 dddd, dd MMMM yyyy HH:mm:ss Tuesday, 22 August 2006 06:30:07


The patterns for DateTime.ToString ( 'g' ) :

0 MM/dd/yyyy HH:mm 08/22/2006 06:30
1 MM/dd/yyyy hh:mm tt 08/22/2006 06:30 AM
2 MM/dd/yyyy H:mm 08/22/2006 6:30
3 MM/dd/yyyy h:mm tt 08/22/2006 6:30 AM


The patterns for DateTime.ToString ( 'G' ) :

0 MM/dd/yyyy HH:mm:ss 08/22/2006 06:30:07


The patterns for DateTime.ToString ( 'm' ) :

0 MMMM dd August 22

The patterns for DateTime.ToString ( 'r' ) :

0 ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Tue, 22 Aug 2006 06:30:07 GMT


The patterns for DateTime.ToString ( 's' ) :

0 yyyy'-'MM'-'dd'T'HH':'mm':'ss 2006-08-22T06:30:07


The patterns for DateTime.ToString ( 'u' ) :

0 yyyy'-'MM'-'dd HH':'mm':'ss'Z' 2006-08-22 06:30:07Z


The patterns for DateTime.ToString ( 'U' ) :

0 dddd, dd MMMM yyyy HH:mm:ss Tuesday, 22 August 2006 06:30:07


The patterns for DateTime.ToString ( 'y' ) :

0 yyyy MMMM 2006 August


Building a custom DateTime.ToString Patterns

The following details the meaning of each pattern character. Note the K and z character.
d Represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero
dd Represents the day of the month as a number from 01 through 31. A single-digit day is formatted with a leading zero
ddd Represents the abbreviated name of the day of the week (Mon, Tues, Wed etc)
dddd Represents the full name of the day of the week (Monday, Tuesday etc)
h 12-hour clock hour (e.g. 7)
hh 12-hour clock, with a leading 0 (e.g. 07)
H 24-hour clock hour (e.g. 19)
HH 24-hour clock hour, with a leading 0 (e.g. 19)
m Minutes
mm Minutes with a leading zero
M Month number
MM Month number with leading zero
MMM Abbreviated Month Name (e.g. Dec)
MMMM Full month name (e.g. December)
s Seconds
ss Seconds with leading zero
t Abbreviated AM / PM (e.g. A or P)
tt AM / PM (e.g. AM or PM
y Year, no leading zero (e.g. 2001 would be 1)
yy Year, leadin zero (e.g. 2001 would be 01)
yyy Year, (e.g. 2001 would be 2001)
yyyy Year, (e.g. 2001 would be 2001)
K Represents the time zone information of a date and time value (e.g. +05:00)
z With DateTime values, represents the signed offset of the local operating system's time zone from Coordinated Universal Time (UTC), measured in hours. (e.g. +6)
zz As z but with leadin zero (e.g. +06)
zzz With DateTime values, represents the signed offset of the local operating system's time zone from UTC, measured in hours and minutes. (e.g. +06:00)
f Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value.
ff Represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value.
fff Represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value.
ffff Represents the four most significant digits of the seconds fraction; that is, it represents the ten thousandths of a second in a date and time value. While it is possible to display the ten thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
fffff Represents the five most significant digits of the seconds fraction; that is, it represents the hundred thousandths of a second in a date and time value. While it is possible to display the hundred thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
ffffff Represents the six most significant digits of the seconds fraction; that is, it represents the millionths of a second in a date and time value. While it is possible to display the millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
fffffff Represents the seven most significant digits of the seconds fraction; that is, it represents the ten millionths of a second in a date and time value. While it is possible to display the ten millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
F Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value. Nothing is displayed if the digit is zero.
: Represents the time separator defined in the current DateTimeFormatInfo..::.TimeSeparator property. This separator is used to differentiate hours, minutes, and seconds.
/ Represents the date separator defined in the current DateTimeFormatInfo..::.DateSeparator property. This separator is used to differentiate years, months, and days.
" Represents a quoted string (quotation mark). Displays the literal value of any string between two quotation marks ("). Your application should precede each quotation mark with an escape character (\).
' Represents a quoted string (apostrophe). Displays the literal value of any string between two apostrophe (') characters.
%c Represents the result associated with a c custom format specifier, when the custom date and time format string consists solely of that custom format specifier. That is, to use the d, f, F, h, m, s, t, y, z, H, or M custom format specifier by itself, the application should specify %d, %f, %F, %h, %m, %s, %t, %y, %z, %H, or %M. For more information about using a single format specifier, see Using Single Custom Format Specifiers.
||\c || Represents the escape character, and displays the character "c" as a literal when that character is preceded by the escape character (\). To insert the backslash character itself in the result string, the application should use two escape characters ("\\").
Any other character copies any other character to the result string, without affecting formatting. ||

Ref: http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

How to make attachment mandatory in SharePoint list form?

Using a list item it is not possible to make the attachment required out of the box. To make this field mandatory we will need to add JavaScript on list form.

Below is the java script which will make attachment field mandatory on list form


<script type="text/javascript" language="javascript">
function PreSaveAction() 

{
    var elm = document.getElementById("idAttachmentsTable");
    if (elm == null || elm.rows.length == 0)
    {

       document.getElementById("idAttachmentsRow").style.display='none';
       alert("Please attach Documents");
       return false ;
    }
    else
    { 
      return true ;
    }
}
</script>


Hope this helps.

Ref: https://social.technet.microsoft.com/Forums/sharepoint/en-US/c93d7611-f634-4c03-ae0d-3b5ecfe5ca6a/how-to-make-attachment-required-field


Friday, 17 April 2015

CSOM vs JSOM vs SSOM vs REST


2013

Model Types:
  • CSOM: Client-side object model. C# (or Visual Basiconly, use NuGet, at the moment same package for both 2010 and 2013.
  • JSOM: JavaScript object model. JavaScript only.
    • SP.ClientContext.get_current() for normal use. new SP.ClientContext('url...') for specific SPSite. Note this works cross-SPSite in 2013.
  • SSOM: Server-side object model. C# (or Visual Basiconly, use Microsoft.SharePoint (15) DLL. Must be deployed on same farm.
  • REST: REST web technologies and standard Open Data Protocol (OData) syntax.
Hosting:
  • SharePoint hostedJavaScript and templates only. By templates I mean list templates, content types, etc. Anything that can be uploaded to the SharePoint virtual file system can also be added, such as .aspx-pages.
  • AutohostedC# (or Visual Basic) only. Currently only supported on Office 365. On app purchase an Azure instance will be automatically provisioned. Uses OAuth to comunicate to SharePoint site.
  • Provider hostedC# (or Visual Basic). Similar to Autohosted, but is meant to be hosted more manually (i.e. On Azure). So you fire up a web application, on any server, and then use S2S to connect to SharePoint.
  • Sandboxed: Remnant from 2010, can be uploaded to Solution gallery. Support for limited subset of the SSOM. No file access, so can not deploy anything to _layouts folder. If you use the limited SSOM-part (C#) your solution will be considered deprecated. Support for templates such as list templates and content types, deployed directly to host web.
  • Farm solution: Full access, deploy through PowerShell.
Technologies table:
+--------------------------------------------------------+
¦               ¦ CSOM ¦ JSOM ¦ SSOM ¦ REST JS ¦ REST C# ¦
¦---------------+------+------+------+---------+---------¦
¦ JavaScript    ¦      ¦  x   ¦      ¦  x      ¦         ¦  
¦ C#            ¦      ¦      ¦  x   ¦         ¦  x      ¦  
¦ From browser  ¦      ¦  x   ¦      ¦  x      ¦         ¦  
¦ From server   ¦  x   ¦      ¦  x   ¦         ¦  x      ¦  
¦ OAuth2        ¦  x   ¦  x   ¦  x   ¦  x      ¦  x      ¦  
¦ S2S           ¦  x   ¦      ¦  x   ¦         ¦         ¦ 
+--------------------------------------------------------+
Hosting table:
+---------------------------------------------------------------------+
¦                     ¦ CSOM ¦ JSOM ¦ SSOM        ¦ REST JS ¦ REST C# ¦
¦---------------------+------+------+-------------+---------+---------¦
¦ SharePoint hosted   ¦      ¦  x   ¦             ¦         ¦         ¦
¦ Autohosted          ¦  x   ¦      ¦             ¦         ¦  x      ¦ 
¦ Provider hosted     ¦  x   ¦      ¦             ¦         ¦         ¦ 
¦ Sandboxed solution  ¦  x   ¦  x   ¦  x(limited) ¦  x      ¦  x      ¦
¦ Farm solution       ¦  x   ¦  x   ¦  x          ¦  x      ¦  x      ¦ 
+---------------------------------------------------------------------+

2010

Model Types:
  • CSOM: Client-side object model. C# (or Visual BasicNuGet and JavaScript.
    • SP.ClientContext.get_current() for normal use. new SP.ClientContext('url...') for specific SPWeb.
  • SSOM: Server-side object model. C# (or Visual Basiconly, use Microsoft.SharePoint (14) DLL. Must be deployed on same farm.
  • REST: REST in 2010 is only for ListData.svc. Note that SPServices (jQuery plugin) utilizes the.asmx services in _/vti/bin , such as /_vti_bin/Webs.asmx
Technologies table:
+-------------------------------------+
¦               ¦ CSOM ¦ SSOM ¦ REST  ¦
¦---------------+------+------+-------¦
¦ JavaScript    ¦  x   ¦      ¦  x    ¦  
¦ C#            ¦  x   ¦  x   ¦  x    ¦  
¦ From browser  ¦      ¦  x   ¦  x    ¦  
¦ From server   ¦  x   ¦  x   ¦       ¦  
+-------------------------------------+
Hosting table:
+---------------------------------------------------------------------+
¦                     ¦ CSOM ¦ JSOM ¦ SSOM        ¦ REST JS ¦ REST C# ¦
¦---------------------+------+------+-------------+---------+---------¦
¦ Sandboxed solution  ¦  x   ¦  x   ¦  x(limited) ¦  x      ¦  x      ¦
¦ Farm solution       ¦  x   ¦  x   ¦  x          ¦  x      ¦  x      ¦ 
+---------------------------------------------------------------------+
Ref: http://sharepoint.stackexchange.com/questions/93269/csom-vs-jsom-vs-ssom-vs-rest



Related Posts Plugin for WordPress, Blogger...