SharePoint – JQuery Scripts Examples

January 28, 2013

Lock input field and change background color

<br>/* --- Doc ready ---*/</p> <p>$(document).ready(function() {<br>/* --- End doc ready ---*/<br>/* --- Set Subject Read Only - Grey Color ---*/</p> <p>$("input[title='Subject']").attr("readonly","true").css<br>('background-color','#ccc').width(370);<br>});

Set a ‘To’ date field based on the ‘From’ date field. As you can see you need to find the proper field ID which is a long unique refference.

<br>/* Set Date Field "TO" based on the Date Field "FROM" */</p> <p>var sFrom= $("[name='ctl00$m$g_2a1915de_8d5b_445a_9443_...<br>Field$DateTimeFieldDate']").val();</p> <p>$("[name='ctl00$m$g_2a1915de_8d5b_445a_9443_2b18a9b32a7...<br>Field$DateTimeFieldDate']").val(sFrom);<br>;

The same as above but then on Change Event of the “From” date Field

<br>/* Set Date Field "TO" based on the Date Field "FROM" Change Event*/</p> <p>$('#ctl00_m_g_2a1915de_8d5b_445a_9443_2b18a9b32a70_ff3...<br>1_ctl00_ctl00_DateTimeField_DateTimeFieldDate').datepicker({<br>onSelect: function(dateText, inst)<br>{<br>$("[name='ctl00$m$g_2a1915de_8d5b_445a_9443_2b18a9b32a...<br>70$ff41$ctl00$ctl00$DateTimeField$DateTimeFieldDate']").val(dateText);<br>}<br>});<br>

Later I will add the print screen of how it looks :

SharePoint -JQuery Tools

January 28, 2013

Recently I needed to break out of the limited features that SharePoint had to offer out of the box. Condition was not to start programming, and especially not to change anything in the Backend of the SP Server.

So the solution was to turn to JScript, it runs client side !

Figure 1. Client Object Model Architecture


JavaScript Class Library

But with nearly ever touched JScript this would take me a while to get into it.

So the final solution came for the JQuery Library.

How to install the JQuery library

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensbility, jQuery has changed the way that millions of people write JavaScript.

And the related SharePoint specific derivate tools, like :

SPFF Field assistant (needs JQuery Libr.)

Dynamic Forms (needs JQuery Libr.)

SPServices on Codeplex (needs JQuery libr.)

SPAPI Webservices Libr (needs JQuery libr.)

Jpoint API Framework Client side

Some examples in a next post.

PowerShell – list MS Exchange Certificates

January 26, 2013

How to list the available certificates on your exchange server, when you run into an event ID 12014 error.

<br>CLS</p> <p># Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010</p> <p># Add Exchange 2010 commandlets (if not added)<br>if(!(Get-PSSnapin | <br>Where-Object {$ -eq <br>"Microsoft.Exchange.Management.PowerShell.E2010"})) {<br>ADD-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010<br>}</p> <p>Get-ExchangeCertificate | fl <br>

Output is like this :

AccessRules        : {System.Security.AccessControl.CryptoKeyAccessRule, …
CertificateDomains : {,,}
HasPrivateKey      : True
IsSelfSigned       : False
Issuer             : CN=Trusted SSL CA, O="Trusted, Inc.", C=US
NotAfter           : 3/04/2019 7:53:44
NotBefore          : 1/03/2012 16:25:22
PublicKeySize      : 2048
RootCAType         : ThirdParty
SerialNumber       : 014xxx
Services           : None
Status             : Valid
Subject            :, OU=Group - IT, O=Group, L=Local, …
Thumbprint         : 0AE4D67E3BC6CBA5AFBD3...

PowerShell – List Modules & SnapIns

January 26, 2013

How to list all available Powershell modules and SnapIns

# list available modules on a the server
Get-Module -ListAvailable
# Get-Module -ListAvailable | Import-Module

# Import the ActiveDirectory cmdlets
Import-Module ActiveDirectory

# For Exchange you can list it using
# List available snapins on your system:

# List registered snapins
Get-PSSnapin -Registered

So it all depends a bit on what you are looking for.


PowerShell – IDE missing on Servers ?!

January 26, 2013


On Windows Server 2008R2 this PS IDE is not installed by default ?

So you need to add it the feature yourself.




Import-Module ServerManager  
Add-Windowsfeature PowerShell-ISE

I hope this helps !

SharePoint Formula syntax errors !

January 24, 2013

Took me hours to find out why a simple formula as this one did always end up in a Correlation Error !

=DATEDIF([Column1], [Column2],“d”)

And answers is simple, when logging on to a Remote Deskop using a different regional settings, you need to use

=DATEDIF([Column1]; [Column2];“d”)

An other example that might be usefull to know

=TEXT(From;”yyyy”) results in 2013

=TEXT(YEAR([Start Date]))  results in 2.013


Enjoy !

SharePoint – How to Export Forms & WFs

January 24, 2013

Sometimes the way to do things is hard to find. Specially in SharePoint designer !

So I looked for an easy was to export all my Custom Forms, WorkFlows, Views etc.

Here’s how :

Open SPD and go the Site –> List you want to export form.


You see the custom Views / Forms / Workflows etc.

on the top press the little triangle to get to the dropdown menu.


Click for instance on Workflows to get the list of available WF’s.


Next on the top menu you can select the EXPORT File (see red arrow).

This will export the WF pages not the Workflow logic, lets say.

Therefore you need to do this procedure :

Open the WF in SPD and then click Export to VISIO


I hope this helps you find your way around SPD.