Validation of list Items
Hi,
I have a list, which has the list columns as student id, student name, address.
The users can add the details of the students by clicking on the New item. If a student id is already added, it should not be re-entered by other users and by the same user.
For example: If the list item is:
Student Id Student Name Address
1 Max Tokyo
Another entry of Student Id of 1 should not be permitted and a message should be given to user as Student Id already exists.
How to achieve this?
Thank you.
November 9th, 2010 2:31pm
Hi,
You can have look on the item adding event handler where you can check for some unique value using CAML to query the list and based on the output decide to allow or disallow new entries.
http://msdn.microsoft.com/en-us/magazine/cc163318.aspx
ThanksAlok
Free Windows Admin Tool Kit Click here and download it now
November 9th, 2010 2:48pm
Hi,
You can have look on the item adding event handler where you can check for some unique value using CAML to query the list and based on the output decide to allow or disallow new entries.
http://msdn.microsoft.com/en-us/magazine/cc163318.aspx
ThanksAlok
November 9th, 2010 2:48pm
you can use UniqueColumnPolicy for primary key value.
Solution:
Step 1 - Download Unique Column Policy Feature from
http://features.codeplex.com/releases/view/2502
Step 2 - Logon to Sharepoint Server, copy UniqueColumnPolicy.wsp to any folder and run these commands:
"c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE" -o addsolution -filename UniqueColumnPolicy.wsp
"c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE" -o deploySolution -name UniqueColumnPolicy.wsp -local -AllowGacDeployment -force
Step 3 - Logon to Central Administration and go to Operations > Manage Farm Features, then deactivate and activate
Unique Column Policy .
Step 4 - go to List Setting > Information management policy settings then check
Define a policy... and press OK.
Step 5 - in Edit Policy Item: check Enable Unique Column Policy then select your column.
Done.
Now when you enter value in student Id which before is insert it, fire message :
Column '<Your Column>' must have a unique value within the list.
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 2:20am
you can use UniqueColumnPolicy for primary key value.
Solution:
Step 1 - Download Unique Column Policy Feature from
http://features.codeplex.com/releases/view/2502
Step 2 - Logon to Sharepoint Server, copy UniqueColumnPolicy.wsp to any folder and run these commands:
"c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE" -o addsolution -filename UniqueColumnPolicy.wsp
"c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE" -o deploySolution -name UniqueColumnPolicy.wsp -local -AllowGacDeployment -force
Step 3 - Logon to Central Administration and go to Operations > Manage Farm Features, then deactivate and activate
Unique Column Policy .
Step 4 - go to List Setting > Information management policy settings then check
Define a policy... and press OK.
Step 5 - in Edit Policy Item: check Enable Unique Column Policy then select your column.
Done.
Now when you enter value in student Id which before is insert it, fire message :
Column '<Your Column>' must have a unique value within the list.
November 10th, 2010 2:20am