Friday, April 28, 2017

SharePoint 2013 Office Web Apps Server is Incompatible with Server 2016

As of the time of this writing Office Online Server for SharePoint 2016 is also incompatible with Windows Server 2016

During on-prem setup, while running either PowerShell commands: 
  • Add-WindowsFeature or 
  • New-OfficeWebAppsFarm 

Office Web Apps Sever for SharePoint 2013 ( or Office Online Server for SharePoint 2016 ) on a Windows Server 2016 box will produce the following error:  
The operation failed. The server did not meet the following prerequisites: - The "Ink and Handwriting Services" Windows Server Feature must be installed and enabled.

But wait, a feature by that name is no where to be found...

In this Microsoft online forum Ned Pyle ( Windows Server Principal Program Manager ) states: 
“Ink and Handwriting Services is now a default part of the operating system and no longer requires a separate package which would explain why you would not find the feature listed but you do see the files in the Program Files path.”

In this other forum a Microsoft Employee further states: 
“The feature [Ink and Handwriting Services] is no longer an optional component, and is installed by default.  This change broke the check in Office Online and it is incorrectly failing.  This is a known issue and a fix is being worked on” [emphasis added]

While the latter forum states “a fix is being worked on” its referencing SharePoint 2016 Office Online Server, not the 2013 version of Office Web Apps.

(Side note: the net result is that neither SP 2016 nor SP 2013 can run on Server 2016 because of an install check for a sub-feature that nobody uses – confusing, I know)

I’ve reached out to other resources to see if any remedy has been made, nothing so far.  I doubt SPOWA 2013 will ever be supported on Server 2016, and since there is no way around “feature-check” I have chosen to soldier-on in a Server 2012R2 environment.
-SharePoint Combatant

Tuesday, March 10, 2015

Add jQuery to Your Sample Page (KSUG 03.10.15)

These are the steps for adding jQuery and Site.js references to your Sample Page using Designer.
Don't have access to Designer?  No problem.  Instructions to do the same using the regular UI are further below.

Creating the Sample Page and adding script tags using Designer

1) Open the "Site Page" folder
2) On the ribbon Click "Web Part Page" drop down
3) Choose "Single Web Part Page"
1) Still in the "Site Pages" folder
2) Right Click on your newly created Sample Page
3) Select "Edit File in Advanced Mode" from the shortcut menu
1) Locate the line indicated
2)  Add the two script tags shown
<%-- add script tags between here... --%>
<script type="text/javascript" src=""></script> 
<script type="text/javascript" src="../SiteAssets/site.js" ></script>
<%-- ...and here --%>

(the comment lines above and below the script tags are optional) 

Or...Creating the Sample Page and adding script tags through the UI

1) Navigate to the "Site Pages" library
2) On the ribbon Click "Files"
3) On the ribbon drop down "New Document"
4) On the ribbon select "Web Part Page"
After naming and saving, open the page
1) On the ribbon Click "Page"
2) On the Ribbon Click the "Edit Page" drop down 
3) On the Ribbon menu Click "Edit Page"
On the page Click "Add New Web Part" (not shown)
1) Click "Media and Content"
2) Click "Content Editor"
Click the "Add" button (not shown )
Once the Content Editor Web Part appears on the page...
1) On the web part Click the drop-down-arrow
2) Click "Edit Web Part" from the menu

Click "Hidden" (we don't want this web part to be visible)
Click "Apply" or "Save" (not shown)
Back on the web part Click the hyperlink shown below 

On the Ribbon select the "Edit HTML" menu item (not shown)
The "HTML Source" dialog box will appear. 
1) Enter the scripts tags into the textbox
<script type="text/javascript" src=""></script> 
<script type="text/javascript" src="../SiteAssets/site.js" ></script>
2) Click OK

Click "Stop Editing"
Happy jQuery-ing

Sunday, February 8, 2015

SOLVED: SharePoint Designer Inserting Blank Lines

Frustrated by Designer adding unwanted blank lines to your .aspx or .master pages?

Here's the problem:

The first time the file is saved in SharePoint Designer blank lines are inserted or added like this...

The second time the file is saved Designer doubles the number of blank lines, plus adds an extra line - a total of three blank lines...

The third time the file is saved it doubles again, adding one line for a total of seven blank lines...

The fourth time the file is saved a total of fifteen blank lines appear (double previous plus one)....

It's simple to see how after several iterations of changes hundreds or thousand of unwanted blank lines can be inserted.

Notice the culprit here - it occurs around lines of literal text within tag-blocks...

Where ever you encounter <SharePoint:ScriptBlock> and <SharePoint:StyleBlock> tags you will experience this problem:

Here's the fix (read all the way to the end):

Simply add an HTML/XML comment tag right after Script or Style Tags.  Like this...

...and that's it.  Fixed.  Save as many times as you want - no more blank lines inserted between these tags.

Crucial Tips!

  • Notice that the comment tag must be on the same line as the <SharePoint:...block> tag. Must!  If you put it on it's own line the problem will persist
  • Adding this text is necessary for every <SharePoint:...block> tag on the page.

Monday, April 7, 2014

How to relocate the page-advance-control displayed at the botton of the list view

In your SharePoint list view you want to accomplish this...

It's simple to do - modify your custom-master-page (BTW the best practice is to NOT edit "default.master" but always use your own custom-master-page - Google how to create a custom master if you are not familiar with this)

If you are working in Visual Studio (creating a site for deployment) locate and open your custom-master-page in the "Modules" folder in Solution Explorer...

Or if using SharePoint Designer, open your site and locate your custom-master-page in the "Master Page" folder...

Once your custom master page is open locate </head> (the closing head tag) and just above it paste the following code...

     <style type="text/css">
          #bottomPagingCellWPQ2 {text-align: left;}

Once added the code (in the larger context of the code block) should look something like this...

Save and deploy (from visual studio) Or Save and Check-in (SharePoint Designer). Refresh your site and now the page-advance-control is located to left in the list view.

If you need to document what you've just accomplished: "Updated the master page to include an inline style that overrides the "text-align" attribute from "center" to "left" on the "bottomPagingCellWPQ2" (id) table-data-cell  (which is where the list-view page advance control is located)."

Users you are developing for, who have list views with many columns, will thoroughly appreciate this enhancement.  Moving the page-advance-control to a handy spot will keep them from continually scrolling to the middle of each new page.

Friday, October 12, 2012

SharePoint and XSLT 1.0 - How to compare dates

UPDATE: Be aware that Microsofts's XSLT library date_templates.xsl contains a minor bug.
Using the "getDateFromDays" template will return NaN (not-a-number) when attempting to calculate the last day of the year (12/31).  All other days calculate correctly.
When it comes to performing date comparisons and calculations in SharePoint using XSLT 1.0 can be tricky, but here's a simple way

Navigate out to this document library

And click on the "XSL Style Sheets" link
Microsoft has created an XSLT file with many handy templates for doing date calculations.
Download this Microsoft XSLT file date_templates.xsl and add it to the "XSL Style Sheets" folder.
Now locate the "ItemStyle.xsl" file and check it out for editing.  Add these styling blocks within the item you wish to transform

<!-- This is an example using the MS date_templates templates -->
<!-- Here it's calculating the date of tomorrow -->
<xsl:variable name="tomorrow">
  <xsl:call-template name="getDateFromDays">
  <!-- This template requires the date in the ISO format -->
  <xsl:with-param name="paramBaseDate" select="ddwrt:TodayIso()"/>
  <xsl:with-param name="paramDelta" select="1"/>

<!-- 1st step in date comparisons in XSLT 1.0 is to convert dates to numbers.  Stripping the dashes from an ISO date converts '2012-10-10' to the number '20121010' -->

<xsl:variable name="tomorrowAsNumber" select="(translate($tomorrow,'-',''))" />

<!-- The Content Query Web Part is returning a list of tasks that contain a field called "Due Date"
<xsl:variable name="listOfTasks" select="/dsQueryResponse/Rows/Row" />

<!-- Count the number of "Tasks Due Now" by converting the "Due Date" criteria to a number and comparing it to the "Tomorrow Number" using "less-than" -->
<xsl:variable name="countOfTasksDueNow" select="count($listOfTasks[translate(substring(@DueDate,1,10),'-','') &lt; $tomorrowAsNumber])" />

<!-- Count the number of "Tasks Due Tomorrow" by converting the "Due Date" criteria to a number and comparing it to the "Tomorrow Number" using "equals" -->
<xsl:variable name="countOfTasksDueTomorrow" select="count($listOfTasks[translate(substring(@DueDate,1,10),'-','') = $tomorrowAsNumber])" />

<!-- Count the number of "Future Tasks Due" by converting the "Due Date" criteria to a number and comparing it to the "Tomorrow Number" using "greater-than" -->

<xsl:variable name="countOfFutureTasks" select="count($listOfTasks[translate(substring(@DueDate,1,10),'-','') &gt; $tomorrowAsNumber])" />

SharePoint & Linq: More with less

Linq makes it easy to navigate thru a record set object of SharePoint List items.

// Using Statement

using System.Linq;

// Build the Query Object
SPQuery queryObject = new SPQuery();
queryObject.Query = 

      <fieldref name="FirstName">
         <value type="Text">Bob</value>
   <fieldref ascending="TRUE" name="Modified">
Now, here's where the magic starts
Super Linq! -  Retrieving list items with a single line of code!

var results = list.GetItems(queryObject).Cast<splistitem>();

// Here's how to see if any records were returned
if (!results.Count().Equals(0))

// Want just the Last record?

var resultItem = list.GetItems(queryObject).Cast<SPListItem>().Last();

// Want just the First record?
var resultItem = list.GetItems(queryObject).Cast<SPListItem>().First();

Tuesday, March 20, 2012

How to Use "Add To All Content Types" When Creating List Columns with Code

The "Add To All Content Types" functionality can be achieved using the "AddFieldAsXml" method with the "AddToAllContentTypes" option, see below

   SPList currentList = currentWeb.Lists["DocLib"];
   SPField newField = currentList.Fields.CreateNewField(SPFieldType.Text.ToString(), "New Field2");
   currentList.Fields.AddFieldAsXml(newField.SchemaXml, true, SPAddFieldOptions.AddToAllContentTypes);

I found this code and an excellent explanation on this blog