How to: Work with the SPQuery
The SPQuery will be in Caml format. You can use one to get a collection of items from a list. For example, SPListItemCollection results = listName.GetItems(query); The above will get a subcollection of items from the listName list, according to the query inside the “query”. In my case, I was looking to implement a Search [...]
Read MoreHow to: Make a custom web part appear in the web part gallery (SP2007)
If you have a custom web part that does not appear in your web part gallery, the most probable cause is that you have not defined it in the module.xml file. Remember that, once you have created a custom web part in VS, you will need to add/reference it in the module.xml file. In your [...]
Read MoreHow to: Troubleshoot “The event handler ‘OnClick’ is not allowed in this page”
While working with an asp.net page in SharePoint 2007 (or, in any other situation where you get this error), when you try to bind the OnClick event of a button to a code behind event receiver, you will get an error saying that you are not allowed to directly access the OnClick event of the [...]
Read MoreHow to: Create a SP2007 Site Collection Template in VS2008 in XML only
So, the other day, I got a curious request. I was to provide a new site collection template, a custom template, that would be using no code whatsoever. The client did not want to deploy custom code to their production server. I had never created a site collection template before. Let alone one that would [...]
Read MoreHow to: Add a “Create New Document” link on a page outside a document library in SP2007
If you want to display a link that allows you to create new items in a SharePoint 2007 document/form library, you can easily do that in a Content Query web part. Just do the following: 1. Navigate to the library where you want to be able to create new items. 2. Open up the [...]
Read MoreHow to: Troubleshoot “Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version.”
If you’re trying to restore a SharePoint 2007 backup file of a site from one SharePoint installation to another, you might get the following error: Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version. The backup file should be restored to [...]
Read MoreHow to: Troubleshoot “This row already belongs to another table” error message
If you’re working with Data Tables you might have tried to copy one table’s rows to another. However, using the .Copy method will result in this error message: This row already belongs to another table. So, how do you deal with that? It’s not that hard really. What you first need to make sure of [...]
Read MoreHow to: Avoid client side programming in SharePoint
When you’re creating web parts, you will find yourself tempted to use javascript to fire off certain events. For example, you could use javascript to control whether a server side control is visible or not, depending on the value of a server side radio button. You could do that. Or, you could remember that multivalued [...]
Read MoreHow to: Deploy/Retract solutions to SharePoint through spsadm
So, everything is just fine when you use the DEPLOY command through Visual Studio to deploy your code to your SharePoint platform but how to do you deploy with the sdsadm? It turns out, it’s not that hard after all. Just follow the steps below to deploy or retract a solution: 1. Add the solution [...]
Read MoreHow to: Debug SharePoint applications (attach to process).
First of all, you will need to turn off the custom errors. If you haven’t already done so, click here to find out how to turn off SharePoint Custom Errors After you’ve done that, you will be able to get more information about your application errors straight from the error page that will be served [...]
Read More