"The day you stop learning SharePoint is the day you stop using it."

Errors while installing SharePoint Server 2013 pre-requisites on Windows Server 2012 R2

You would find tons of blogs discussing the below first error* while installing SharePoint 2013 pre-requisites. I also encountered the second error about .Net framework 3.5.  
  •   Application Server Role, Web Server (IIS) Role: configuration error*
  •  .Net Framework 3.5 not enabled.

The first error was displayed in both pre-requisites tool window (also known as SharePoint Server 2013 Preparation Tool) and the log file which is generated by the tool. While the second error was found only in the log file. So make sure you read the complete log file generated by SharePoint Server 2013 Preparation tool. You should not miss any error that might keep you troubling all the way ahead.

To resolve the first error Application Server Role, Web Server (IIS) Role: configuration error I executed two steps:

1.1 Add Web Server Role and Application Server Role to your Windows Server via Server Manager.
  • Go to Server Manager > Add Roles and Features.
  • Select your server in the Server Pool under Server Selection page.
  • Select Web Server (IIS) Role and Application Server Role.
  • Click Next until the wizard finishes.
1.2   Edit the Local Policy on your Window Server.
  • Run MMC
  • Click File > Add/Remove Snap-in
  • Select Group Policy Object Editor and Add it.
  • Navigate to Administrative Templates > System
  • Double click Specify Settings for optional component installation and component repair.
  • Check the Enabled radio button and select “Contract Windows Update directly to download repair content instead of Windows Server Update Services (WSUS) check box”.

To resolve the second error .Net Framework 3.5 not enabled you must add .Net Framework 3.5 feature via Server Manager > Add roles features.
  • In Server Manager, click Manage and then select Add Roles and Features to start the Add Roles and Features Wizard.
  • On the Select installation type screen, select Role-based or feature-based installation.
  • Select the target server.
  • On the Select features screen, check the box next to .Net Framework 3.5 Features.
  • On the Confirm installation selections screen, a warning will be displayed asking Do you need to specify an alternate source path? If the target computer does not have access to Windows Update, click the Specify an alternate source path link to specify the path to the\sources\sxs folder on the installation media and then click OK. After you have specified the alternate source, or if the target computer has access to Windows Update, click the X next to the warning, and then click Install.
  • If you are using Server Manager in Windows Server 2012 to add a role or feature to a remote server, the remote server’s computer account (DOMAIN\ComputerName$) requires access to the alternate source file path because the deployment operation runs in the SYSTEM context on the target server.
Reference: https://technet.microsoft.com/en-us/library/dn482071.aspx

These were the two resolutions I implemented, restarted the server and re-ran the pre-requisites tool and got everything working fine. Hope this helps you.

Add Date Time automatically in SharePoint Blog Post

In this post we would be discussing on how we can disallow users to select the Published (Date-Time) field while creating a blog post in SharePoint. Like below:

Our aim is to set the Published automatically as per the current system's date-time.
If you are thinking to follow the usual way of hiding fields from the list form then you are not thinking about the impact it would have. I am talking about the below steps:

Go to the Advanced Settings of this list, set Allow Management of Content Types equal to Yes. Click on the Post content type, click on the Published column, and select Hidden.

The user will no longer have the option to set the published date/time. Note that it will still be set, but will be set the default current time.
The above two steps will land you in trouble and your blog's date-time will not be visible on blog post, even in list view. To tackle this issue there is a trick here to get the date-time on the post without Published field being available to the user.
Create a SPD workflow to publish on Post list. In this workflow simply create one step to update thePublished field value with Modified field value as show in below image. Ensure to only select "Start the workflow automatically when an item is created" at the Start Options in SPD.
Now create a post after publishing the workflow and you will see the date-time on your post and even in the list view with Published column being unavailable to the author.

Working with SharePoint 2010 Content Query Web Part & XSLT to create custom event date calendar

I was assigned to create an Event Calendar Display web part that may show employees leave plans in the IT department. I created the web part with the help of this awesome article http://labs.steveottenad.com/sharepoint-2010-xslt-date-formatting/ and I achieve what I needed. Later I felt the need of adding paging to the web part and started researching for it and came across below another awesome article references mentioned in point 3 and 5. Thanks to all the authors for doing this wonderful job.
  1. I Opened SPD and copied ContentQueryMain.xsl and ItemStyle.xsl from XSL Stylesheet folder to a custom folder, while keeping both default xsl files unchanged.
  2. I copied the xsl code and css code given in this article SharePoint 2010 XSLT date formatting to create the customized event calendar "Upcoming Events" (as shown in article) to my copied ItemStyle.xsl file. (Read the whole article and you will understand how you can perform this step).
  3. Download: ImtechContentQueryWebPart.wsp custom web part from this link:http://imtech.codeplex.com/ [This web part is a custom Content Query Web Part through which you can apply your own xsl files).
  4. Install the ImtechContentQueryWebpart to your SharePoint server and activate it through site collection features in Site Settings.
  5. Now go step by step and make changes again to your copied ItemStyle.xsl and ContentQueryMain.xsl files as explained in this article: Retro-fitting existing XSL Stylesheets with the Paging Controls
  6. The author in the article referenced in point 5 has pasted the code below <xsl:template name="Default" match="*" mode="itemstyle"> Instead a I posted the code below this line<xsl:template name="EventDisplay" match="Row[@Style='EventDisplay']" mode="itemstyle">The above line having EventDisplay you will find in your copied & edited ItemStyle.xsl file. Simply search the term EventDisplay and you will get it.
    Finally insert the Imtech Content Query Web Part to your page and copy the path of copied ItemStyle.xsl and ContentQueryMain.xsl files. Paste these paths as shown below in first image:
    enter image description here
    And the final result you get is: [*Please note the Leave Type and Click Here is appearing due to my own customized code in ItemStyle.xsl. Rest the output is same as shown in article referenced in point 2.]
    enter image description here

I am posting my retrofitted custom ItemStyle.xsl which I managed to create with above steps. I am posting an extract of my ItemStyle.xsl below that would help in adding Leave Type and Click Here.
-First create a Leave Type drop-down column in your SharePoint Calendar List and also create a simple text column CalendarLink having a default value as "http://yoursiteURL,Click Here". This value would be created for every item you enter in SharePoint Calendar List. In Leave Type column enter any values like Annual Leave, Medical Leave or just anything of your choice.

If you observe my below code attentively then you will make out how I have referenced Leave Type and CalendarLink columns in the code. If you have any doubts or face any challenge, feel free to leave a comment and I will surely love to respond.

You can even copy my below code to your custom ItemStyle.xsl and get the job half done. Rest you should take care of ContenQueryMain.xsl, and Custom Columns.

Thank you for reading this article and making my effort feel worth it !

<xsl:template name="EventDisplay" match="Row[@Style='EventDisplay']" mode="itemstyle">  
   <xsl:param name="CurPos" />  
      <xsl:variable name="dateTime" select="ddwrt:FormatDate(string(@EventDate), 1033, 3)" />  
      <xsl:variable name="dateTimeCondensed" select="ddwrt:FormatDate(string(@EventDate), 1033, 2)" />  
      <xsl:variable name="date" select="substring-before(substring-after($dateTime, ', '), ', ')" />  
      <xsl:variable name="month" select="substring-before($date, ' ')" />  
      <xsl:variable name="day"  select="substring-after($date, ' ')" />  
      <xsl:variable name="time" select="substring-after($dateTimeCondensed, ' ')" />  
      <xsl:variable name="SiteLink" select="substring-before(@CalendarLink,',')"/>  
   <xsl:variable name="SiteName" select="substring-after(@CalendarLink,',')"/>  
   <xsl:variable name="LeaveData" select="concat($SiteLink,'/dispform.aspx?ID=',@ID)"/>  
      <xsl:variable name="SafeLinkUrl">  
           <xsl:call-template name="OuterTemplate.GetSafeLink">  
              <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>  
      <div class="item link-item">  
           <div class="description xslCal">  
                <div class="left">  
                     <span class="month"><xsl:value-of select="$month" /></span>  
                     <span class="day"><xsl:value-of select="$day" /></span>  
                <div class="right">  
                     <span class="title"><xsl:value-of select="@Title" /></span><br/><br/>  
               <span class="Category">Leave Type: <xsl:value-of select="@Category" /></span>  
      <a href="{$LeaveData}"><xsl:value-of select="$SiteName"/></a>  
        <xsl:if test="$PageSize &gt; 0">  
          <xsl:variable name="NumPages" select="ceiling($TotalRecords div $PageSize)"/>  
          <xsl:variable name="PageBeforeLast" select="$NumPages - 1"></xsl:variable>  
          <xsl:variable name="CountBeforeLastPage" select="$PageBeforeLast * $PageSize"></xsl:variable>  
          <xsl:variable name="LastPageCount" select="$TotalRecords - $CountBeforeLastPage"></xsl:variable>  
            <xsl:if test="$PageNumber = $NumPages and $CurPos = $LastPageCount">  
               <xsl:call-template name="PagingControls">  
                <xsl:with-param name="Page" select="1" />  
                <xsl:with-param name="NumPages" select="$NumPages" />  
            <xsl:if test="$CurPos = $PageSize and $NumPages &gt; 1 and $PageNumber != $NumPages">  
             <xsl:call-template name="PagingControls">  
              <xsl:with-param name="Page" select="1" />  
              <xsl:with-param name="NumPages" select="$NumPages" />  
      <xsl:template name="PagingControls">  
   <xsl:param name="Page" />  
   <xsl:param name="NumPages" />  
   <xsl:if test="$Page = 1">  
    <xsl:text disable-output-escaping="yes"><![CDATA[<div>]]></xsl:text>  
    <xsl:if test="$PageNumber &gt; 1">  
     <xsl:variable name="PreviousPageNo" select="$PageNumber - 1"/>  
     <a href="?{$PagingParameterName}={$PreviousPageNo}">  
      <xsl:text disable-output-escaping="yes"><![CDATA[&laquo;]]></xsl:text> Prev  
     <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>  
    <xsl:when test="$Page = $PageNumber">  
      <xsl:value-of select="$Page"/>  
     <a href="?{$PagingParameterName}={$Page}">  
      <xsl:value-of select="$Page"/>  
   <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>  
   <xsl:if test="$Page &lt; $NumPages">  
    <xsl:call-template name="PagingControls">  
     <xsl:with-param name="Page" select="$Page + 1"/>  
     <xsl:with-param name="NumPages" select="$NumPages" />  
   <xsl:if test="$Page = $NumPages">  
    <xsl:if test="$PageNumber &lt; $NumPages">  
     <xsl:variable name="NextPageNo" select="$PageNumber + 1"/>  
     <a href="?{$PagingParameterName}={$NextPageNo}">  
      <xsl:text disable-output-escaping="yes"><![CDATA[&raquo;]]></xsl:text>  
    <xsl:text disable-output-escaping="yes"><![CDATA[</div>]]></xsl:text>  


Hide a field from SharePoint Designer Form - NewForm/DisplayForm/EditForm

To hide a field from any of the SharePoint Designer Form we usually create a custom form and edit the code and add a style attribute as style="display:none" in <tr> element.

But what if you do not want to create a custom form and hide the field on the default form? Is it possible? The answer is YES.

You can hide the field on default SPD form via PowerShell command without having to create a custom form.

Open SharePoint Management Shell and type the following commands. The below example hides a field from a NewForm.

$web = Get-SPWeb webUrl
$list = $web.Lists.TryGetList("ListName")
    $field = $list.Fields["FieldName"]
    $field.ShowInNewForm = $false

You can similarly execute the below command for DisplayForm and EditForm. The only statement you need to change is:
$field.ShowInDisplayForm = $false
$field.ShowInEditForm = $false

Identify the type of SharePoint List Template

There are three methods that I know to identify the type of SharePoint List template. All the methods has easy steps to execute and find the type:

     1. Using Browser Method
·         Open that SharePoint List which you want to identify its type and ensure to open that list in AllItems.aspx view. Then in your web browser click on the menu bar > View > Source or simply right click on the page and select View Source and search for ctx.listTemplate.
·         Once you find ctx.listTemplate then match its value with the available List Template IDs (Click Here).

     2. Using PowerShell Command
·         Connect to your SharePoint Server and open SharePoint 2010 Management Shell.
·         Type the following commands that would retrieve all list and libraries in a web site. Search the name of your target list/library and match the Type_Client with List Template IDs given in above link.

>> $SPWeb = Get-SPWeb “http://yourSharePointServer/
>> $SPWeb.ListTemplates | Select Name, type, type_client, Description



Using XML
·         Go to List/Library Settings and from the browser URL copy the string that appears after List=
·         Open this web site http://meyerweb.com/eric/tools/dencoder/ and paste the copied string and press Decode button.
·         Now copy the decoded string paste it somewhere in notepad.
·         Get the SharePoint web site URL under which the list/library is created.
·         Now construct the URL as below example:

·         In the above URL all remain same except the website URL before /_vti_bin/ and copy your decoded List ID and put it inside the braces { } after List=
·         Then finally copy the entire constructed URL and paste into IE and press Enter.
·        In the XML returned by browser search for text ServerTemplate and match its value with the List Template ID, link provided in point 1.

Author's Profile

My Photo
A SharePoint Enthusiast working as a Senior SharePoint & Web Consultant for a premier global company. I believe in giving back to the community through which I also learn and develop and eventually grow as an individual and professional. This blog is a small contribution to the community where I live in and may help someone who is seeking knowledge like me. Apart from being a SharePoint Enthusiasts, I am a husband, a father and a blogger. I love to travel and explore new landscapes and meet people of various culture. I am passionate about learning new technology trends in IT. I love spending time on my fitness and have a deep enthusiasm for urdu poetry and career counseling.

Popular Posts

Powered by Blogger.

Contact Form


Email *

Message *

Total Pageviews