Month: July 2006

SharePoint: Programmatically Setting Lookup Fields

No Picture

Although when you get a lookup field, it returns a value ID;#LookupFieldValue (e.g. 45;#test@example.com), when you set it, you just pass it the id: // To Get SPWeb web = new SPSite(“http://url/to/web”).OpenWeb(); SPList list = web.Lists[“listname”]; string lookupFieldValue…

Read More »

System.Reflection

No Picture

I’ve been wondering how to do stuff in C# similar to $$i from my PHP days – i.e. dynamically calling properties on an object, when I do not know their names at compile time. Example code using System;…

Read More »

SharePoint: Adding list items remotely

No Picture

To add an item remotely to a SharePoint list, you need to use the _vti_bin/list.asmx web service. Note that this must be called at the url of the site where the list resides, e.g. http://myserver/sites/mainsite/subsite/_vti_bin/lists.asmx Node that your…

Read More »

SharePoint: Adding choice fields programmatically

No Picture

As I know I will forget this, and I couldn’t find any decent examples on the web to do this, the code below shows how to add a choice field programmatically to a SharePoint list (with populated choices)….

Read More »

Cruise Control.NET

No Picture

I was introduced to cruise control.net the other day – and was very impressed by its power, as well ease of setup and use. Cruise control.NET is a build tool that polls a source repository (eg sourcesafe, cvs)…

Read More »

Opening and resealing SharePoint .stp files

No Picture

Just so i remember – you can look at and modify the contents of a SharePoint .stp file by saving it and then changing the extension to .cab. You can then open, view and extract the contents of…

Read More »

C# Inheritance Summary

No Picture

I thought id summarise some key facilitators of inheritance in C# to provide a quick reference of when and where to use these. Im going back to the core language features here a little, just to consolidate the…

Read More »

Reading a config file from a test project

No Picture

Reading a config file from a test project. Simply put the config file in the bin folder (the config file must be named the file dllname.dll.config, where dllname is the name of the test dll). To access the…

Read More »

Converting share point display name to internal name

No Picture

Note to self: to convert from a SharePoint display name to the internal name, you must escape space characters with _x0020_ and truncate to 32 characters (if more). Note I am not sure if there are any other…

Read More »