Monday, October 31, 2011

Great JSON library for .NET

Last night, I came across a great JSON serialization/deserialization library for .NET - http://json.codeplex.com/ (Newtonsoft.Json). It provides features similar to System.Xml & System.Xml.Linq, but for JSON.
I simply needed to build a custom well-formed JSON response from my AJAX service, and the library had everything  I needed.

Saturday, October 29, 2011

Mono XSP problem on Windows

With the latest builds of Mono (2.10.5, 2.10.6) XSP web server does not work on my Windows 7 machine. XSP starts correctly but when you send an http-request from your browser to XSP server, the page just hangs and no response is received. As a solution I have downloaded MonoDevelop 2.8 package, which has it's own newest XSP server. The server from MonoDevelop package seem to work just fine in Windows 7 environment.

Friday, October 21, 2011

"Invalid data has been used to update the list item. The field you are trying to update may be read only" SharePoint disaster.

Today I have spent hour and a half trouble-shooting my simple script that uploads CSV data to SharePoint list. On the line that contained item.Update() call (item object is an instance of SPListItem class), I kept getting "Invalid data has been used to update the list item. The field you are trying to update may be read only".

Well the solution was simple, but it just took me hour and a half to figure it out:

NEVER write data to "LinkTitle" field, it is readonly! Use "Title" field instead.

SPBuiltInFieldId.LinkTitle and SPBuiltInFieldId.Title may be used accordingly.

Tuesday, September 20, 2011

Url address without query string in .NET

I was going through a System.Uri class and found the following handy method:
public string GetLeftPart(UriPartial part)
This allows to get certain combined parts of the URL.
For instance if you have address "http://myhost.com/local/path/Page.aspx?field1=Name&value1=abcdef" and you need to cut it to "http://myhost.com/local/path/Page.aspx" part, you could do the following:
Uri uri = new Uri("http://myhost.com/local/path/Page.aspx?field1=Name&value1=abcdef");
string addressPart = uri.GetLeftPart(UriPartial.Path);

Wednesday, September 7, 2011

Replacing TFS service account

Today I had an issue with TFS. To describe the problem shortly: I needed to replace old TFS service account with the new one. 
The following magic command did the trick :

tfsadminutil changeaccount domain\tfs_svc domain\tfs_svc_new password_for_tfs_svc_new

Command's description can be found here: http://msdn.microsoft.com/en-us/library/ms253107(v=VS.90).aspx