Thursday, 22 July 2010

Validate if date is between two dates

I had this unique request coming from a user, he was using a Sharepoint list which had two date fields. Let us asume these fields to be "Order Date" and "Processed Date". The user wanted to make sure people enter a valid "Processed Date" which lied between "Order Date" and "Todays Date". Now SharePoint by default does not any such field validation functionality.

I tried googling, but there was nothing readily available for SharePoint. The next thing came to my mind was using a Javascript snippet, but how do I add the snippet to the code was another challenge. Please read through the article below to understand how to go about this.

1. First task was to create a list for the customer which had "Order Date" and "Processed Date"
2. Once this is created I need to write a Javascript snippet which will make sure the Processed Date is in between "Order Date" and todays date(current date)

so here is it:



3. Now that the snippet is ready I need to find a way to include this to the "NewForm.aspx" and also to "EditForm.aspx", Initially I though of using SharePoint Designer to do this, but somehow though there could be an easier way. Finally after 3 days and sevral cups of tea I found that I can add a content editor webpart the "NewForm.aspx" and "Editform.aspx" page . Normally "Edit Page" option is grayed out for these pages. But there is a cheat to get in

Just append "ToolPaneView=2" to the end of the URL for example

http://servername/site/sitename/lists/OrdProc/NewForm.aspx?ToolPaneView=2








4.Next step is to add a contet editor webpart to the bottom of the page and copy the javascript snippet to the source editor. Click on Save and Apply ok on the webpart properties menu. Thats it its done!!.


5. Now it is time for testing, first I tried to key in a "Processed date" before the "Order Date" and as you can see I got a pop up "The Processed Date should be between Order Date and Todays Date" Bingo!!


6. The second thing I need to test what happens if I choose a date later that todays date.





and as you can see in the above pictures, it worked!! . You can also use the same two validate date between two differrent dates other than today, just tweak the javascript.

Thursday, 1 July 2010

What's new in Office 2010

Office 2010 is here! like me most of you may be thinking if one should go and upgrade to Office 2010 yet. Well here is a list of new features of Office 2010 as compared to Office 2007/2003. Go ahead take look and decide See What's new in Office 2010

Wednesday, 31 March 2010

SharePoint Admin Tool Kit 4.0 installation issue on 32 bit environment

Last week I was trying my hands on SharePoint Admin Tool Kit Ver 4.0 (freely available for download from the microsoft site), this tool has some useful features for Administrators as well as users. Particularly I liked the Permission Reporting tool. Installation on a 64 bit environment went through fine and I could also see the Batch Site Manager (helps with Move, Lock and Delete Site Collections ) in Central Admin Page and Permission reporting links coming up individual site collections, however when I tried to install the same on a 32 bit environment although there were no errors I could not see the Batch Site Manager link coming up in Central Admin Page nor the permission reporting tool links on the Site Collections. This was really strange, no errors!, but at the same time tool is not installed!!

After a lot of digging around, I found the installation is not complete after the exe is run for 32bit environment , thanks to nitman's comment there are couple of steps that need to be run manually, which ideally should have been taken care by the exe itself
To deploy and activate the Batch Site Manager feature


1. At the command prompt, run stsadm.exe -o addsolution -filename "C:\ProgramFiles\Microsoft\SPAdministrationToolkit\BatchSiteManagerSolution\BatchSiteManager.wsp" to add the solution file to the farm solution store.

2. Run stsadm.exe -o deploysolution -name BatchSiteManager.wsp -immediate -allowgacdeployment to deploy the solution to the farm.

3. Go to Central Admin -> Operations -> Solution Management, confirm batchsitemanager.wsp status is deployed.

4. Run stsadm -o activatefeature -name BatchSiteManagerLinks to activate the feature.

To deploy and activate the Permission Reporting Tool feature

1. At the command prompt, run stsadm.exe -o addsolution -filename "C:\Program Files\Microsoft\SPAdministrationToolkit\PermissionReportingSolution\PermissionReporting.wsp" to add the solution file to the farm solution store.

2. Run stsadm.exe -o deploysolution -name PermissionReporting.wsp -immediate -allowgacdeployment to deploy the solution to the farm.

3. Go to Central Admin -> Operations -> Solution Management, confirm permissionreporting.wsp status is deployed.

4. Run stsadm -o activatefeature -name PermissionReporting to activate the feature.

Tuesday, 30 March 2010

SharePoint Server 2010 Beta Product Key

If you are not able to locate the SharePoint Server 2010 Beta, Product key on the download site,
SharePoint Server 2010 Beta(Enterprise Client Access License features) product key: PKXTJ-DCM9D-6MM3V-G86P8-MJ8CY

Monday, 22 March 2010

Resolution for SP 2010 installation issue

Last week I had mentioned that I am facing some issues with SP 2010 foundation installation and I keep getting prompted for server reboots. I was able to get through it and I alomost for got to share the resolution...

I would like to thank Bill Baer for neatly listing all the SP 2010 installation issues and how to overcome them, if you have faced any other issue other than the one I faced please refer Bill Baer's blog

I have an extract from the blog that helped me

Setup is unable to proceed due to the following error(s):


A system restart from a previous installation or update is pending. Restart your computer and run setup to continue.

For the list of pre-requisites needed to install the product please refer to:

http://go.microsoft.com/fwlink/?LinkId=106209

Correct the issue(s) listed above and re-run setup.


Check the value of the following Registry keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\UpdateExeVolatile - if the value of the UpdateExeVolatile Registry key is anything other than 0 you will see this message.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations - if the PendingFileRenameOperations Registry key has any value you will see this message.

To remove an orphaned UpdateExeVolatile registry key value

Open a registry editor, such as Regedit.exe or Regedt32.exe.

Navigate to HKLM\SOFTWARE\Microsoft\Updates\

In the right navigation pane, double-click the UpdateExeVolatile key.

Configure the key with a value of 0

Close Registry Editor.

To delete the orphaned PendingFileRenameOperations registry key

Open a registry editor, such as Regedit.exe or Regedt32.exe.

Navigate to HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\

In the right navigation pane, right-click the PendingFileRenameOperations key and select Delete.

Close Registry Editor.

Ready to Evaluate SP 2010

Now that I have setup a virtual environment with SP2010, I was literally stuck..thinking ...now what!!!

I guess Microsoft heard me and I found this real good evaluation guide on their technet site http://technet.microsoft.com/en-us/library/cc262881(office.14).aspx . The guide starts from what's new and runs through installation, deployment and upgrade options. I found this guide really helpful.

SharePoint 2010 + Virtualization

With SharePoint 2010(64bit) we definately lost one advantage!! i.e setting up a VM for development or for that matter just to play around with the new features on a laptop(32bit)......or did we??

The moment this came to my mind I started to explore the possibility of setting up a 64 bit VM on my laptop and I could find more than one option and here they are. I am sure there are people like me who wish to setup 2010 on their laptop I hope this will help them out.

1.Vitrual Box from Sun
2.Microsoft® Hyper-V™ Server 2008 R2  is another good option
3. VMware Workstation is really good if you do not mind spending some money on your VM

of course there are more than 3 options available like the native boot to VHD option available on Windows 7 and Windows Server 2008 R2. Out of the list I particularly liked the Hyper-V as it lets me reserve most of the memory that I have on my laptopn to the VM