List level Validation in SharePoint 2010

In my earlier article, I wrote about column level validation in SharePoint 2010.

List level validation will trigger before saving the content. The validation should return TRUE to save the content.

Library Information List:

I have created sample list Library Information with the following columns.

Validation Scenario:

Due date should be greater than Issue Date.

Validation Settings:

Go to List Settings and click on Validation settings.

Specify the validation rule “DueDate > IssueDate”, then specify the error message to be displayed for the user.

Save the Validation Settings.

Create new item in list.

If the validation fails, the error message will be displayed to the user.

User Profile Exception Error while Creating Sample Data in SharePoint 2010 Configuration Wizard

I encountered the following error while running Configuration wizard for SharePoint 2010.

You need to Install the hotfix for Windows Server 2008 R2 / Windows 7. Download here from Microsoft Connect.




Error in Log File:

01/09/2010 13:20:05 17 ERR An exception of type Microsoft.Office.Server.UserProfiles.UserProfileException was thrown. Additional exception information: Unrecognized attribute ‘allowInsecureTransport’. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56)

Microsoft.Office.Server.UserProfiles.UserProfileException: Unrecognized attribute ‘allowInsecureTransport’. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56) —> System.Configuration.ConfigurationErrorsException: Unrecognized attribute ‘allowInsecureTransport’. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56)

at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)

at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)

at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)

at System.Configuration.ConfigurationSectionCollection.Get(String name)

at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Client()

at Microsoft.Office.Server.UserProfiles.MossClientBase`1.GetServiceBinding(String endpointConfigurationName)

at Microsoft.Office.Server.UserProfiles.MossClientBase`1.GetChannelFactory(String endpointConfigurationName)

at Microsoft.Office.Server.UserProfiles.MossClientBase`1.get_Channel()

at Microsoft.Office.Server.UserProfiles.MossClientBase`1.ExecuteOnChannel(String operationName, CodeBlock codeBlock)

at Microsoft.Office.Server.UserProfiles.ProfilePropertyServiceClient.ExecuteOnChannel(String operationName, CodeBlock codeBlock)

— End of inner exception stack trace —

at Microsoft.Office.Server.UserProfiles.ProfilePropertyServiceClient.ExecuteOnChannel(String operationName, CodeBlock codeBlock)

at Microsoft.Office.Server.UserProfiles.ProfilePropertyServiceClient.GetProfileProperties()

at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.RefreshProperties(Guid applicationID)

at Microsoft.Office.Server.Utilities.SPAsyncCache`2.GetValueNow(K key)

at Microsoft.Office.Server.Utilities.SPAsyncCache`2.GetValue(K key, Boolean asynchronous)

at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.InitializePropertyCache()

at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.Provision()

at Microsoft.SharePoint.PostSetupConfiguration.EvalModeProvisionTask.ProvisionServiceApplicationsAndProxies()

at Microsoft.SharePoint.PostSetupConfiguration.EvalModeProvisionTask.Run()

at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()

Column Validation in SharePoint 2010

Most of the developers faced issues with column validations in SharePoint 2003/2007.

It is really painful to write the validation using custom approach like javascript or jquery.

SharePoint 2010 provides the following validations in Out of the Box.

  • Column Level Validation
  • List Level Validation

Column Level Validation

While creating new column in list, click on the column validation node.

Specify your validation formula.

e.g.

[FieldName]=”Value”

The formula should return TRUE for validation to PASS.

Create New column in List and Specify the validation Settings.


Create new item in List, Click save to validate.

WOW….life is easy with SharePoint.

State Tuned to hear about List level validation in my next post.

CodePlex Release : List Search WebPart

Hi Community,

I have contributed List Search WebPart for SharePoint in CodePlex.

Project Description:

This Project provides the List Search WebPart for WSS 3.0 / SharePoint 2007. Just add the WebPart to page and specify the list name, filter fields, display fields and criteria.

Simple Interface for Tool Part with advanced features for list search.

Features

  • Ajax Enabled
  • Easy configuration of list
  • Automatically populates List collection in Drop Down List
  • Filter Fields Selection
  • Display Fields Selection
  • Query operator Selection

Configuration Steps

Open the WebPart in Edit Mode.

Filter Fields: Fields to be rendered at page with input box for filter fields.

Display Fields: Fields to be displayed in grid.

Condition criteria between the fields

When you apply changes the WebPart will render as below:

Please leave your new feature requests here: http://www.mstechblogs.com/Forums/viewtopic.php?f=17&t=2&start=0

How to Create Custom Menu Item in Site Actions

The below sample feature creates new menu item in Site Actions menu, Please replace the GUID in the below code.

Sample Feature File

<?xml version=”1.0″ encoding=”utf-8″?>

<Feature

Id=”<GUID>”

Title=”Custom Menu Item”

Description=” ”

Version=”1.0.0.0″

Scope=”Site”

Hidden=”False” xmlns=”http://schemas.microsoft.com/sharepoint/”>

<ElementManifests>

<ElementManifest

Location=”elements.xml” />

</ElementManifests>

</Feature>

Sample Elements file

<?xml version=”1.0″ encoding=”utf-8″?>

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>

<CustomAction Id=””

GroupId=”SiteActions”

Location=”Microsoft.SharePoint.StandardMenu”

RequireSiteAdministrator=”TRUE”

Title=”My Blog”

Description=” ”

Sequence=”1″>

<UrlAction Url=”http://www.mstechblogs.com/sharepoint “/>

</CustomAction>

</Elements>

TreeView Doc Lib V 2.0 in CodePlex

I have released the next version of TreeView Document Library WebPart for SharePoint 2007.

Added features in this release:

  • Automatically populates the list of document libraries in dropdownlist in toolpart
  • Collapsed TreeView can be managed from toolpart property
  • Automatically shows the appropriate icons for the files in document library

WebPart included as feature in solution package.

Please post your comments or additional feature requests.

Programmatically Retrieve List of Document Libraries

The following code snippet is used to retrieve the list of document libraries.

SPWeb _web = SPContext.Current.Web;


SPListCollection ListColl = _web.Lists;


foreach (SPList _lst in ListColl)

{


if (_lst.BaseTemplate == SPListTemplateType.DocumentLibrary)

{

LibList.Items.Add(_lst.Title);

}

}

BaseTemplateType can be used to identify the Type of list.

Microsoft.IdentityModel assembly Missing Error while installing SharePoint 2010

While running SharePoint Configuration wizards, if you get an error “Microsoft.IdentityModel assembly missing”

Make sure you have installed “Geneva Framework”, its part of your pre requisites for SP 2010

Download SharePoint 2010 Beta

Microsoft has released the beta bits of SharePoint 2010 for MSDN & Tech Net subscribers.

I hope it will be available for public in few days J

SharePoint 2010 Technology Stack

SharePoint 2010 Technology Stack looks like below.

The key advantage for the developers would be the development machine can be set it up in Windows Vista or Windows 7 (x64-bit) machine J