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 :

Advertisements

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

clip_image002

JavaScript Class Library

http://msdn.microsoft.com/en-us/library/ee538253(v=office.14).aspx

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

http://jquery.com/

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.)http://spff.codeplex.com/releases/view/28099

Dynamic Forms (needs JQuery Libr.)http://sharepointjavascript.wordpress.com/2012/05/29/dynamic-forms-for-sharepoint-production-release/

SPServices on Codeplex (needs JQuery libr.)http://spservices.codeplex.com/

SPAPI Webservices Libr (needs JQuery libr.)http://ekoncis.blogspot.be/2011/05/sharepoint-query-with-spapi.html

Jpoint API Framework Client side http://jpoint.codeplex.com/releases/view/37224

http://www.sharejpoint.com

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 {$_.name -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 : {owa.group.com, mail.group.com, autodiscover.group.com}
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            : CN=owa.group.com, 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:
Get-PSSnapin

# List registered snapins
Get-PSSnapin -Registered

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

Success


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.

image

 

Or

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

USEFUL TIP: 
ALMOST ANY FORMULA YOU CAN PUT TOGETHER IN EXCEL, YOU CAN COPY TO A SHAREPOINT CALCULATED COLUMN AND IT SHOULD WORK JUST FINE.

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.

image

You see the custom Views / Forms / Workflows etc.

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

image

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

image

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

image

I hope this helps you find your way around SPD.