Saturday, July 19, 2008
Sahil Malik also shows you how to perform Joins on two SPList and to represent data in a parent/child format. Check here:
Monday, July 14, 2008
There is a workaround which my colleague and me came up with. But this workaround is if you want to totaly disable ECB menu for a particular list. Actually there are couple of workarounds, but its upto you which one you wanna go with (depending upon the time constraint).
First is create your own custom web part which will list all the items using SPGridView and then you can customize it as per your requirement and place that web part within a PlaceHolderMain of your custom copy of AllItems.aspx page. For this you will have to remove the View from a List Definition. This is a time consuming process and I would recommend this only if you have to do lot of customization to your ListView Webpart on AllItems page.
Second option is to use a different column to disaply Title column of a list. For any list there are three types of Title columns. a) Title b) LinkTitleNoMenu c) LinkTitle
Now you can set any of these columns in a view of either a List Definition or from the user interface. So ,this way you can decide if you want to have a ECB menu for a particular list or not.
Sunday, July 6, 2008
I have used two tools and developed some code snippets. I will teach you in my next post on how to create these code snippets for feature.xml, elements.xml, onet.xml or any other xml code that you will need to make your development fast.
The tools that I have used are very familiar STSDEV and Andrew Connel's Project Utility Tool. Now you must have already seen, heard or used these tools. But since both the tools have their drawbacks, so we can use both these tools in sync to suit our needs. You can check above links to know in detail about these tools.
STSDEV: Gives us the flexibility of creating .ddf file, .wsp package, deploying assemblies to GAC, adding SafeControl to web.config on deployment and many build types. But one thing that needs to be done manually in STSDEV is creating folder structure. It does creates a basic RootFiles folder structure for you but if you have to add any more folders which has got a deep tree structure then you have to keep adding it manually. This is where Project Utility Tool plays its role.
Andrew Connel's Project Utility Tool : Also gives us benefit of creating .ddf file, .wsp package and more. But it has its drawbacks of not being able to handle any changes in .ddf file manually and some more stuff that STSDEV gives. So we will use this tool for generating the folder structure in a project that STSDEV has created.
I am not really commenting here on which is a good tool or a bad tool. I am really giving you an idea to utilise best of the outcomes of both tools and increase your efficiency and performance in developing custom SharePoint solutions. We really don't want to waste our time in doing repeated things when developing a SharePoint solution so why not use these beautiful tools which makes our life easier.
And also, I am not saying this is the best way to create and maintain Visual Studio projects for SharePoint solutions. If anybody has got any different idea then please do mention it here and share the knowledge among MOSS geeks :-)
Friday, July 4, 2008
There are around more than 100 services that run on a Windows 2003 Server. Some of these services might be useful and some may not be. So why not disable them rather than letting them chew your server resources. There are five basic service that you can quickly think of disabling. These are listed below:
1. ERSvc - Error Reporting Service (Used for reporting application crashes to Microsoft)
2. HidServ - Human Interface Device Access (Used for other smart devices, which you might not use on a server)
3. IsmServ - Intersite Messaging (Used for sending messages from server to server)
4. ScardSvr - Smart Card Access
5. LMHosts - TCP/IP NetBIOS Helper
Now these services are just the start. There is a list of other services that you can check, if you really need them. TechRepublic gives you such list. You can downlowd it from here.
Hope this might be helpful in some instances. Like you can disable such services on your VPC which you might be using as a development environment.
Tuesday, July 1, 2008
Now for adding a new site column to custom list, you can add it directly when provisioning custom List Definition you can learn this here. But if you want to add a site column to already provisioned list you need to do it through object model.
Firstly you need to find the system content type for a List. Every list in in SharePoint uses a content type, either system content type or custom content type. You can view the content type hierarchy here. And you can find an associated content type for a system List using following lines of code in a console app:
using (SPSite site = new SPSite("http://devmoss/)"))
using (SPWeb web =
//List Content types in a web
foreach (SPContentType ct in web.ContentTypes)
//List Content types in a List
SPList list = web.Lists["Posts"];
foreach (SPContentType ctl in list.ContentTypes)
Now once you know the content type of a List in which you wish to add a
custom column, you can use it add a new SPFieldLink to that SPContentType
object. Below is the sample code:
using (SPSite site = new SPSite("http://devmoss001/)"))
using (SPWeb web = site.OpenWeb())
string newColumn= "New Column";
//Construct required content type objects
SPContentType wikiContentType = web.ContentTypes["Wiki Page"];
//Check if the site column already exists
//If the site column doesn't exist then create a new column and assign it to custom columns group
popularity = web.Fields.Add(newColumn, SPFieldType.Number, true);
SPFieldNumber fieldNum = (SPFieldNumber)web.Fields[newColumn];
fieldNum.Group = "Custom Columns";
//Get the field reference of new site column
SPFieldLink fieldLink = new SPFieldLink(web.Fields[newColumn]);
if (fieldLink != null)
//Add the site column to wiki content type
catch (SPContentTypeSealedException ex)
catch (SPContentTypeReadOnlyException ctEx)
catch (SPException ex)
//Write to Logger
I hope that will be of some help to you. If you have any questions related to this concept then feel free to write to me.