Reusing Css styles in Nintex Workflow notification emails

Workflows can have a lot of notifications and customizing and reformatting them individually can take a bit of time, perhaps a better way would be to apply css styles somewhere in a single css file and reuse it through out.

Nintex Workflow uses a css file containing default styles which it embeds within emails. We can easily create a copy it with our custom styles and this way we can avoid changing css for every single notification and also if we want to apply a simple change to all notification emails, it can be simply be applied to this single file.

To do this, let’s first download the default css file. Please go to Central Administration, Nintex Workflow Management and then Global Settings, you will see a link to css file

Paste this url in the browser to download this css, it would be something like http://SharePointServer:Port/_layouts/15/NintexWorkflow/HtmlEditorStyles.css

Let’s rename this file to avoid overwriting the default and edit it.

Now to publish changes upload the new file to anywhere in layouts folder, change the link above and save it.

There a quite a few style rules in this css, Be mindful of the comments above which states that each style rule must be followed by a { on the next line and end with a } on its own line for the parser to function correctly

All have the styles have some meta data information embedded with “–ms-” prefix and this is how email editor maps styles. For example at the top there are styles for colors with –ms-color prefix and some colors, if we take the first one, -ms-color says “Dark Red” and now we see it in email editor there is a Dark Red color as well, now we change color attribute value here we can use this in the editor, we can even change names so it is easier to find.

.ntx-rteForeColor-1
{
  color: darkred;
  -ms-name: "";
  -ms-color:"Dark Red";
}

Likewise there are styles for Fonts, Headings and others. To change default font and styles in body, we can make changes in following rule

.ntx-rte-messageBody
{
  font-family: Calibri, Verdana, Arial, Sans-Serif;
  font-size: 11pt;
  color: Black;
}

One of the most frequently used one would be changing styles for tables. Default styles are listed in design tab in ribbon upon selecting a table and we can customize one these styles.

In the CSS file these styles are named with –ms-name attribute, try searching for “Table Style 2 – Medium” and then you can which style is being used. Following are rules being applied to this table design

.ntx-rteTable-1
{
  -ms-name:"Table Style 2 - Medium";
  border-width: 0px;
  border-style: none;
  border-collapse: collapse;
  font-family: Tahoma;
}

.ntx-rteTable-1 tr.ntx-rteTableHeaderRow-1
{
  margin: 10px;
  padding: 10px;
  color: #3F4D6B;
  background: #D6E8FF;
  text-align: left;
  font-size: 10pt;
  font-style: normal;
  font-family: Tahoma;
  text-transform: capitalize;
  font-weight: bold;
  border-spacing: 10px;
  line-height: 14pt;
  vertical-align: top;
}

.ntx-rteTable-1 td.ntx-rteTableHeaderFirstCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
  color: #3a4663;
  line-height: 14pt;
}

.ntx-rteTable-1 td.ntx-rteTableHeaderLastCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
  color: #3a4663;
  line-height: 14pt;
}

.ntx-rteTable-1 td.ntx-rteTableHeaderOddCol-1
{
  padding:0in 5.4pt 0in 5.4pt;
  color: #3a4663;
  line-height: 14pt;
}

.ntx-rteTable-1 td.ntx-rteTableHeaderEvenCol-1
{
  padding:0in 5.4pt 0in 5.4pt; color: #3a4663;
  line-height: 14pt;
}

.ntx-rteTable-1 tr.ntx-rteTableOddRow-1
{
  color: #666666;
  background-color: #F2F3F4;
  font-size: 10pt;
  vertical-align: top;
}

.ntx-rteTable-1 tr.ntx-rteTableEvenRow-1
{
  color: #666666;
  background-color: #E7EBF7;
  font-size: 10pt;
  vertical-align: top;
}

.ntx-rteTable-1 td.ntx-rteTableFirstCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
}

.ntx-rteTable-1 td.ntx-rteTableLastCol-1
{
  padding:0in 5.4pt 0in 5.4pt;
}

.ntx-rteTable-1 td.ntx-rteTableOddCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
}

.ntx-rteTable-1 td.ntx-rteTableEvenCol-1
{
  padding:0in 5.4pt 0in 5.4pt;
}

.ntx-rteTable-1 tr.ntx-rteTableFooterRow-1
{
  background-color: #D6E8FF;
  color: #4A5A80;
  font-weight: 500;
  font-size: 10pt;
  font-family: Tahoma;
  line-height: 11pt;
}

.ntx-rteTable-1 td.ntx-rteTableFooterFirstCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
  border-top: solid gray 1.0pt;
  text-align: left;
}

.ntx-rteTable-1 td.ntx-rteTableFooterLastCol-1
{
  padding:0in 5.4pt 0in 5.4pt;
  border-top:solid gray 1.0pt;
  text-align:left;
}

.ntx-rteTable-1 td.ntx-rteTableFooterOddCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
  text-align: left;
  border-top: solid gray 1.0pt;
}

.ntx-rteTable-1 td.ntx-rteTableFooterEvenCol-1
{
  padding: 0in 5.4pt 0in 5.4pt;
  text-align: left;
  border-top: solid gray 1.0pt;
}

I hope you find this post useful, thanks.

Nintex Workflow 2010 – The workflow could not update the item, possibly because one or more columns for the item require a different type of information.

While trying to set field value or update list item action after set item permissions for setting workflow initiator’s permission to read only so that he or she could not modify the list item I was getting the following error in email.

The workflow could not update the item, possibly because one or more columns for the item require a different type of information.

On the workflow status page in the history list an event was logged with Error event type and outcome of that event was access denied.

After exploring a little bit I found out that this error was coming because Nintex workflow runs in the user context of initiator so if the initiator doesn’t have permission to modify list items set field value and update list items actions would fail.

There is a way to run the workflow in the context of user who publishes it. Thia option can be enabled by editing an action, go to common settings and then enable “Run as workflow owner”. This option is not available in all actions so to use it in actions where it is not available please drop an action set action in the workflow, enable this setting and then drop the actions you want to use, in my case I was using state machine workflow and then was using set field value.

image

I hope you find this post useful. Thanks for reading.

Powershell to create calendar in SharePoint with categorized overlays

Creating calendars in SharePoint 2010, changing default categories and then creating view and overlay for each category can take a lot of clicks. To save time and effort I created a powershell script which can be used as follows

& ‘.\Calendar Overlay.ps1’ -webUrl {SITEURL} -listName “{LISTNAME}” -categories “{CommaSeparatedCategories}”

It takes three command line parameters which are

-webUrl – The site url where you want to create the calendar

-listName – The name of calendar list

-categories – Comma separated values for categories

For example if you would like to create a calendar named Yearly events on http://myspsite/marketing with road show, marketing boot camp 1 and digital campaign 1. You can pass in the following arguments

& ‘.\Calendar Overlay.ps1’ -webUrl http://myspsite/marketing -listName “Yearly Events” -categories “Road show, Marketing Boot camp 1, Digital Campaign 1”

The resulting calendar would look like

Calendar overlays created with Powershell

Source for the script is as follows:

###############################################################################
# Creating Calendar overlays in SharePoint 2010 using Powershell
# Version          : 1.0
# Url              : https://khurrampunjwani.wordpress.com
# Creator          : Khurram Punjwani, http://twitter.com/khurrampunjwani
###############################################################################

param (
    [string]$webUrl = $(throw "-webUrl is required."),
	[string]$listName = $(throw "-listName is required."),
    [string]$categories = $(throw "-categories is required.")
 )

[array]$categoriesArray = $categories -split ","

Function Get-SPCalendarWeb(){

	#Clear screen first
	Clear-Host
	
	#Load web where Calendar is supposed to be created
	$web = Get-SPWeb -Identity $webUrl
	Write-Host "SP Web Loaded " $web.Title
	
	#Create new calendar
	New-SPCalendar

	$web.Dispose()
}

Function Add-TestEntries($cal){
	$listItem = $cal.AddItem()
	$listItem["Title"] = "Test 1"
	$listItem["Category"] = $categoriesArray[0]
	$listItem["EventDate"] = [System.DateTime]::Now
	$listItem["EndDate"] = [System.DateTime]::Now.AddHours(4)
	$listItem.Update()
	
	$listItem = $cal.AddItem()
	$listItem["Title"] = "Test 2"
	$listItem["Category"] = $categoriesArray[1]
	$listItem["EventDate"] = [System.DateTime]::Now
	$listItem["EndDate"] = [System.DateTime]::Now.AddHours(4)
	$listItem.Update()
}

Function New-SPCalendar(){
	$web.Lists.Add($listName,"",[Microsoft.SharePoint.SPListTemplateType]::Events)
	$cal = $web.Lists.TryGetList($listName);
	
	Write-Host "Calendar created"
	
	#Delete default categories and add the ones specified in command line
	Add-CalendarCategories $cal
	
	#Add Views with Filters
	Add-SPCalendarViews $cal

	#Add test entries
	Add-TestEntries $cal
}

Function Add-SPCalendarViews($cal){
	$view = $cal.Views["Calendar"]
	$viewFields = $view.ViewFields.ToStringCollection()
	$viewData = ""
    $viewData += ""
    $viewData += ""
    $viewData += ""
    $viewData += ""
	#XML for calendar overlays
	$calendarSettings = "  "
	#To show different color for category views
	$colorIndex = 1 
	
	#Create views for categories so there will be one view for each category
	foreach($category in $categoriesArray){
		#Create filter for the view to show events from the respective category
		$viewQuery = ""
		$viewQuery += ""	
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += %{"{0}" -f $category}
		$viewQuery += ""
		$viewQuery += ""
		$viewQuery += ""
		
		$newView = $cal.Views.Add($category,$viewFields,$viewQuery,3,$false,
			$false,"CALENDAR",$false)
		$newView.ViewData = $viewData
		$newView.Update()

		%{"View created for {0} category" -f $category} | Write-Host
		
		#Update XML for Calendar Overlay, each view would be added as an overlay
		$calendarSettings += %{"  " -f $category}
		$calendarSettings += %{"

Getting authentication prompt again and again while trying to access #SharePoint 2010 Rest Interface

While trying to access to ListData.svc service in a SharePoint 2010 sub site I was getting authentication prompt to enter credentials again and again. I was using a SharePoint Farm administrator account so was sure that permission is not the cause of this problem. So I started SharePoint Manager, browsed to the sub site and saw that there was a problem in a feature

SharePoint Manager Site Feature List

Afterwards I checked in the list nodes of the same site to see which lists were included in this missing feature, after clicking on one of the lists I got the following error which hinted that this list was the one included in the feature.

SharePoint Orphaned list exception

Further in the properties window there was an error message in the content type field

SharePoint Manager List Properties

I deleted this orphaned lists and the service worked fine then.

I hope you found this post helpful. Thanks

Download links for Office Server 2010 and #SharePoint 2010 Service Pack 2 (#SP2) Packages

SharePoint Service Pack 2 (SP2) has been officially released. It was published on 21st July 2013 and contains new updates which improve security, performance, and stability. Please refer the SP2 change list for complete list of fixed issues.

This service pack includes all cumulative updates (CU) from June 2011 till April 2013 and public updates (PU) from July 2011 till May 2013 which were released after Service Pack 1 (SP1)

To download, please click the following links.

Microsoft SharePoint Server 2010 Service Pack 2 KB2687453
Microsoft SharePoint Foundation 2010 Service Pack 2 KB2687464
Microsoft SharePoint Foundation 2010 Language Pack Service Pack 2 KB2687466
Microsoft FAST Search Server 2010 for SharePoint Service Pack 2 KB2687446
Microsoft Search Server 2010 Service Pack 2 KB2687461
Microsoft 2010 Server Language Pack Service Pack 2 KB2687462
Microsoft Office Web Apps Service Pack 2 KB2687470
Microsoft SharePoint and Project Server 2010 Service Pack 2 KB2687452
Microsoft Groove Server 2010 Service Pack 2 KB2687448
Microsoft SharePoint 2010 Indexing Connector for Documentum Service Pack 2 KB2687459
Microsoft Duet Enterprise for SharePoint and SAP Service Pack 2 KB2687445
Microsoft SharePoint Designer 2010 Service Pack 2 (64-bit) KB2687463
Microsoft SharePoint Designer 2010 Service Pack 2 (32-bit) KB2687463

Please note June 2013 CU is not included and has to be installed separately. To download it, please click the following links.

SharePoint Foundation 2010 June 2013 CU

SharePoint Server 2010 June 2013 CU

Thanks for reading and have a nice day. Cheers

Changing SharePoint 2010 lookup column Date Time and Number formatting

Few days back I was creating a report using SharePoint 2010 list as data source in Report Builder 3. The list I was using had the following lookup columns:

  • StartDate (DateTime Column)
  • FinishDate (DateTime Column)
  • Budget (Number)

Now when I tried to change the datetime and number formatting, I noticed formatting was not being applied.

After spending some time I found out that in order to apply number and datetime formatting to lookup columns, they must be converted to a proper data type. So instead of binding field directly to a column, I used the following expressions to convert these lookup columns in proper data types

Convert SharePoint 2010 lookup column to proper data type

The complete list of conversion functions can be found under Common functions and then Conversion. In my case for dates I used CDate(FieldName) and for number column I used CInt(FieldName)

Convert SharePoint 2010 lookup column to proper data type

Why AutoSPInstaller?

Let’s assume we’ve to create a new SharePoint 2010 server so we install SharePoint 2010 and then start the configuration wizard. After we’re through with the configuration wizard, most probably when we’ll start SQL Server Management Studio we’ll see something like the following

SharePoint Databases with Guids

This type of inconsistent naming can be very unpleasant and might not be very handy for our DBAs, wouldn’t it be better if we’d something like

So what we do. We can run some powershell scripts to manually configure our Farm and install services (For more details, please visit http://technet.microsoft.com/en-us/library/cc262839.aspx#section6)

Another good alternate is that we use AutoSPInstaller which can automate the process of installing (including downloading and installation of pre- requisites) and configuring SharePoint 2010 based on inputs we provide in an xml file. There is an editor available to edit scripts for AutoSPInstaller as well called AutoSPInstallerGUI

For detailed instructions on how to use AutoSPInstaller, please visit http://www.softlanding.ca/Blog/Lists/Posts/Post.aspx?ID=30.

Thanks for reading. I hope you found this post useful. Please don’t forget to share this post. Cheers