Wednesday, February 23, 2011

Points to note while doing Field and List level Validation

Formulas
  1. You can only compare column values to one another in a list level validation.
  2. A validation formula at the column level cannot include any other columns besides itself.  For example, [Column1]>[Column2] is an invalid formula and SharePoint will not allow it to be used at the column level.  In this case, you want to use list-level validation.
  3. There is only one formula available at the list level. 
  4. The formula syntax is similar to that used in Calculated Columns
There are a few dozen functions available - I have not tried every one.  One interesting thing to note is that SharePoint 2010 would not allow me to use the TODAY function, even when validating a Date field.  [DateColumn]>TODAY is not a valid validation formula.

Conflicts
  1. What if you have both column level validation and list level validation?
    1. The column level formulas will be evaluated first, then the list formulas
  1. What if the column and list level validations are in conflict?
    1. Example - at the list level, you require that [Text1] = [Text2], but each column has it's own validation; [Text1]="AAA", and [Text2]="BBB".  In this case, it will be impossible to actually submit a list item.  The column validations are evaluated first, but if the values validate here, they will of course fail the list validation.
  1. What if the list level validation includes columns not included in a particular content type?
    1. If a column used in the list formula isn't available in the current content type, validation will always fail.  This means that if you have multiple content types in your list,  you should not validate at the list level for a column that is not included in all content types on the list.  These columns can only be validated at the column level.

Site Columns
  1. You can set validation on custom columns of the field types listed above
  2. You can override the validation of a site column at the list level

Friday, February 4, 2011

InfoPath forms getting information from Active Directory

I had a request where I had to develop an InfoPath form for a project and user wanted a people picker in that form. In SharePoint lists/libraries we can use a "Person and Group" column which gets info from AD and will display all names but to have the same functionality in InfoPath we have to follow few manual steps BUT the good news is this do not need any programming.

2007 ships with a control called Contact Selector Control that will resolve this issue!

Wednesday, February 2, 2011

Where are all other site templates in SharePoint 2010

I was creating a new publishing site collection SP 2010 and noticed that when I click on "Publishing" tab, there were only two available options:

Custom Site Template with Publishing feature enable in SharePoint 2007

I had a request to create a custom site template for reusability. As we always enable "Publishing Feature" for all team sites, I tried to save an existing site as template. But you know what, site with Publishing feature, does not provide an option to "save site as template".

Then I tried a trick to open save site as template page:

So just to make it clear.  If your subsite is
http://sites/toplevelsite/teamsite/default.aspx
You would go to :
http://sites/toplevelsite/teamsite/default.aspx/_layouts/savetmpl.aspx

Here you should be able to save site as template.BUT the problem was not solved. Doing this, when you try to create a new site from this template, it is not going to work. It will throw an error and your site is not created.

So to explain in one line, you have to save site templates without enabling "Publishing Feature" and then activate it manually after creating a site from this template.