Search This Blog

Friday, September 21, 2012

Server for SharePoint Production and Development environments

There are many vendors out there who provide server hardware. However this post I will mention a specific one which I have had good experience with.
Traditionally all servers from HP / Dell / IBM have been so that it does not allow for adding PCI / PCIe cards for adding your own Video cards. Well a possible reason for that: Who will buy a workstation PC if servers allowed that? However with the new VDI (Virtual Desktop Infrastructure) scenarios things have changed. Ofcourse we always want the server to be powerful and at the same time would be nice to see the display in full HD i.e. atleast 1920 x 1080 Pixels and in 32 bit colors. So far that was not possible as mentioned above. But now it is - Here is a server (besides few other from Dell which do that) i.e. Dell R720 server. It is a 12th Generation server and there are many neat things about it:

a) Allows video cards to be added using the PCIe x16 slots. - Tested with AMD FirePro 4900 and works ok. The only thing to make it work - disable the onboard video from BIOS after adding the new card and on re-boot.
b) How about Sound card - well most of the sound cards are PCI. PCI and PCIe slots are not compatible.
However PCIe is backward compatible which means a PCIe 1x card would work ok in a PCIe X16 slot.
Hence a PCIe 1x sound card should work just fine. Have not tested this though therotically it looks feasible.
An external USB sound connection works very well - Tested and this works.
c) 10 GBPS ethernet card. Now that is fast. We can have the VMs on the server talk to each other thru 10GBps connection. Now imagine that network speed betweeb SharePoint WFE and SQL VM if they are on the same server. It has a LOM (Lan on Motherboard) module which makes traffic within VM at blazing speeds.
d) Dual Xeon 8 core processors with hyperthreading i.e. 16 physical cores however shows 32 CPU in windows because each core is hyperthreaded.
e) Noise: Really low noise i.e. less than what a Desktop PC makes
f)  Heat: Remains around 26 C to 27 C most of the time. Higher CPU usage may push that number higher.
g) Allows maximum RAM to upto 768 GB. That's pretty high a number.
h) RAID card options with 512 Mb or 1 Gb caching - a must for good I/O performance.
i) Cost: Similar config from HP would cost atleast 2K-3K more than Dell (number may vary based on configuration).
j) Plenty of disk slots. If you need xtra storage Dell has R720xd  (xd is for Xtra Drives or Disk). However xd may not support a GPU I believe (please check with Dell).

While playing video files on this server in a VM- the CPU usage percentage occasionlly jumps to 1% and most of the time remains at 0%.  Well that is a powerfull server! Ofcourse using more resources would trigger that to high number.

Dell has really outperformed with its 12th generation server and I want to kudos to the guys for the new design. Overall this server would be a good candidate for SharePoint production server as well as for SharePoint development team so that they can get the full desktop experience from VMs on this server.

With Windows Server 2012 now some things have improved i.e. RemoteFX does not require a physical GPU since it provides a s/w based Virtual GPU. Though for intensive video work, H/W card is still recommended.

I will definitely recommend this server to our clients for SharePoint installations.

That's all for now. Untill next time...

-- Mohan
Disclaimer: Am not associated with Dell and they are not involved in writing of this article in anyway. The above are personal experiences with using Dell R720 server. I liked the product and hence expressesd my opinion.

Wednesday, September 19, 2012

Using LINQPad for SharePoint Development

Well may be you are already familiar and using this but if not - please continue reading.
While Visual Studio 2010 /2012 are great editors for SharePoint Development, there is another tool which we can use for quick function writing and testing. It's called LINQPad

It's a small footprint application with no installation components - just one self contained exe.
I have used this for testing functions and then copy over to large SharePoint projects so that building and testing the function is easier than testing the same function in a large application.
Though there is free version also but in my opinion that is useless i.e. without intellisense it will make it difficult to program. The Pro version is only around $35 - ask your boss and he will not have any issues with that. That same copy of license can be installed on multiple machines which you own and use - that is another plus.

How to setup for SharePoint development:

After downloading the application, run the .exe.
The .exe does not run if it is renamed, so need to be LINQPad.exe only. There are multiple versions however the one which works with SP 2010 is .Net 3.5 version. The X86 and X64 versions do not work with SP 2010.

How to setup for SharePoint development:
After editor shows up, press F4.

Add the references from ISAPI folder. By the way all the references are not required and the bare minimum is Microsoft.SharePoint.dll . Click on set as default for new queries so that these are set for all code files we create henceforth.

Next click on the additional namespce imports tab and

and type in Microsoft.SharePoint.
Click ok.

From editot window - select C# program as shown below (we can use other options also) however this way we can write multiple functions in the same file and then call those from Main( )

The editor is ready to use now.

Overall Pros:
a) Lightweight
b) Low cost
c) Fast editor and with syntax highlighting and intellisense

a) No step by step debugging (use .dump( ) function to write the values to output.
b) While testing with a SPWeb and using GetTemplates it cached the list of templates and that was a issue since after creating new Site Templates, the code did not show those. Closing the editor and re-opening fixed the issue.

Well we can not compare it with all the things VS.Net offers but for the given cost - it offers a lot.

Also this would not work with SP 2013 because it is built for .Net 3.5 SP1.
So far have used VS.Net 2012 with SP 2013 but not LINQPad .Net 4.0 and that may work with SP 2013.
If you try that please write back...

That's it and until next time...

-- Mohan

Disclaimer: Am not associated in anyway with LINQPad. The above is only based on personal experience on using this tool.

Tuesday, September 11, 2012

Column .. does not exist. It may have been deleted by another user

System.ArgumentException: Column 'ColumName' does not exist. It may have been deleted by another user.  /ListPath    at Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalN

If we see the above error, don't panic there is a fix.

Cause: A workflow association was deleted from a list. Every time a workflow is associated and "run" on at least 1 item of the list - workflow creates a internal column with the first 8 characters of the workflow association.
Example: if your workflow association name was "MyWorkflow" the column name would possibly be "'MyWorkfl"

Hence above error would be"
Column: 'MyWorkfl' does not exist. It may have been......

Now if workflows were run using this association and later removed, clicking on workflows from context menu (ECB menu) will give the above error.

Create a new workflow association with the same name i.e. this time give the exact same name i.e.
MyWorkfl. Use the out of the box approval workflow, check option allow to start manually. Start the workflow manually on one item on the list.
The workflow column MyWorkfl is recreated automatically.
Remove the option allow workflow to be manually started from this association but do not delete this association. Let it sit there. Go back to old items which had these workflows. The error should go away.

-- Mohan

Sunday, August 26, 2012

What's new with InfoPath 2013

Well the short answer is there is no new functionality added  to InfoPath 2013 from InfoPath 2010.
Here is a link with more info:
However for writing form code - Now it uses full Visual Studio 2012 instead of VSTO which is good change.

Reason: The VSTO with InfoPath 2010 was limited to using .Net 2.0 framework
whereas the InfoPath 2013 creates the Form code in .Net 4.0
Hence that limitation of API while writing InfoPath code is overcome now.


Wednesday, July 11, 2012

Value cannot be null. Parameter name: source

on updating a list item an error was thrown:

i.e. Value cannot be null: Parameter name: Source:

Reason:  The value supplied to the Lookup column were not correct.

listItem.LookFieldName = new SPFieldLookupValue(Id, Title)
where Id is the Id of the item in destination list and Title is the value of the Title field.

If the value of Id is wrong this error is generated.

Solution: Obvious: Provide the correct value for Id from destination list.

Tuesday, May 1, 2012

Workflow configurations settings using Powershell - SP 2010

MOSS 2007 had Stsadm get and set property commands to change the workflow config settings.

In SP 2010 using Powershell it is Get-SPFarmConfig and Set-SPFarmConfig

Set-SPFarmConfig -WorkflowPostponeThreshold 30

Verify the configuration is set by Get-SPFarmConfig as shown in image above.

Here is more info on these:

Thursday, January 26, 2012

Validate comments at the time of Check in of a document

When a document library has "Require documents to be checked out before they can be edited" enabled and if the comments are required - there is no out of the box way to do so.

Well here is a small trick to get that functionality:

Write a cusom event handler on ItemCheckingIn which validates if the comments are entered; and if not - Cancels the check in with a error message shown to the end user. In the following code snippett an additional check is made for length of characters entered which can ofcourse be removed or changed to a different length. Would be ideal if that length is read from another List which could be called as Config list for a project hence if it was 20 chars - change the config list and we are done. 

public override void ItemCheckingIn(SPItemEventProperties properties)
string checkInComment = properties.AfterProperties["vti_sourcecontrolcheckincomment"]  as string;
//check for comments being blank or length less than some number of chars.
 if (string.IsNullOrEmpty(checkInComment) || checkInComment.Trim().Length < 5)
      properties.ErrorMessage = "The Version Check in comments should be atleast 5  characters long.";

properties.Cancel = true  


The key above is the property "vti_sourcecontrolcheckincomment" which contains the comments entered by user. Just to re-iterate ChekingIn event is raised before the document is checked in.

-- Mohan