SharePoint
Custom property of SharePoint web part doesn’t show up
SharePoint usually surprises me on the most busiest moments. I wrote web part that has some custom properties. These properties were simple ones and it was okay to show these properties in Miscellaneous section of web part property sheet. Although properties were defined nothing new showed up in property sheet.
Writing messages to ULS (Unified Logging System)
If you want to make your SharePoint solution more SharePoint way you can write your tracing, debug and error messages to SharePoint log. Easiest way to do it is to write logger by yourself. Btw, SharePoint has class called ULS to write messages to logs but this class is internal and we cannot use it. But it is there.
SPListItemCollection.GetDataTable() – be careful
Seems like I am stuck in ADODB days a little bit and I still expect that query with no results returns at least some meta data. Or at least my code gets no bombed by null references.SPListItemCollection has GetDataTable() method that returns items collection as ADO.NETDataTable objects. Be careful when using this method – if your items collection is empty then this method returns null.
SharePoint: temporary solution for GetCustomProperty and SetCustomProperty errors
Another day, another kinky problem with SharePoint. This time I struggled with custom properties of my custom field. I tried out different code samples to make GetCustomProperty and SetCustomProperty to work but no luck at all – nothing worked for me. There was no errors when adding field to list or changing field properties but custom properties were never saved.
Querying SharePoint lists
The best way to get data from SharePoint lists is to query them. Using queries you guarantee that only list items you really need are retrieved from database and constructed to objects by SharePoint. Most of the time you don't need the full collection of list items, so it is not point to ask all the items and then use only few of these. Let's see how we can query SharePoint lists.