Friday, May 15, 2009

Office 2003 datasheet view behavior

So for those of you out there still dealing with Office 2003 here in an annoyance that I found:

If you have a list with folders, and you go into one of the folders and try to create some items in DataSheet view, as soon as you create a row it will seem to disappear! What happens is that it actually gets created at the root level of the list! If you have Office 2007 the item gets successfully created inside the folder. The only way to get items into folders with 03 is to use the NewItem form but this can be a huge pain if you are trying to create 200 items at once.

Apparently this isn't something that is going to get fixed, it has to do with the fact that Office 2003 was designed to work with WSS 2.0 which did not allow you to create folders in Lists. Oh well, now at least you have been warned.

Friday, May 8, 2009

More DataForm WebPart goodies

Here is another handy control for use in data form web parts:

<td class="ms-toolbar" nowrap="">
<SharePoint:FormToolBar runat="server" ControlMode="New"/>
</td>


(Added the td class so it looks right)

This renders the normal listform toolbar (since if you just do Data View->Insert Data View, you don't get it).

Friday, May 1, 2009

DataSource CAML Keywords

So recently I needed to display the newest item added to a Very Large List via a dataform web part. The performance on SPQuery is pretty good as long as you return less than 2000 rows from your query. This means that you can't just return all of the list items from the datasource and then sort for the newest one. Instead I used some CAML keywords to help out. My DataSource query filtered on:

<Eq><FieldRef Name="Author" /><Value Type="Integer"><UserID /></Value></Eq>

and

<Eq><FieldRef Name="Created"/><Value Type="DateTime"><Today/></Value></Eq>

These two CAML rendering elements (for the current date, and current users ID). Helped the query return a very small number of rows, which could then be sorted by created date to show the newest.