Monday 23 August 2010

May have a partial fix to creating a filtered Dataview for "within the past 14 days"

It seems that if you create a regular view in Sharepoint and then open the .aspx file in SharePoint Designer you can convert the view to a DataView (an XSLT view). If the original view had a filter on it then that filter is carried over into the Dataview.

I tested this out and it does appear to work. The thing is that if you look at the filter it doesn't appear to say it's going to do what it actually does. The original filter was:
ImportantDate >= [Today] - 14
i.e. ImportantDate is after or is the date 14 days before today. The filter in the DataView is:
ImportantDate is greater than or equal to [Current Date]
i.e. ImportantDate is Today or a later date.

However, when the view is displayed it displays data for the past 14 days and future dates. So, on the one hand it's "Yay it works!" but on the other it's "I don't know why it works." The latter makes me very wary of putting it into production.

Resolved - " 'Edit Document' requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 6.0 or greater." error

One of our users reported a problem where they could open documents in Read-Only mode OK but if they tried to open them for edit they got an error message box, " 'Edit Document' requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 6.0 or greater.". They had IE 6 SP2 and Office 2003 so should be fine, but they were not.

After some research found Microsoft Knowledgebase article 833714 (and many forums and blog posts that linked to it) which contained a number methods to resolve this error message. We found that whilst their system claimed to have SharePoint support installed in the Office install it did not show as an add-on in IE. We removed and re-installed SharePoint support and they could open a document in edit mode.

We did also find a blog post that indicated that KB833714 doesn't always resolve this issue. The recommended resolution in that situation is to completely remove and re-install Office.

A number of the blog and forum posts identified the cause of the problem as the user has components from more then one version of Office installed (e.g. Office 2003 and OneNote 2007) and the older one installs a patch or update. This can result in older versions of DLLs being registered over newer versions. This may be the case here as this user had both Office Professional 2003 and Office Standard 2003, not exactly the same but close.

Thursday 19 August 2010

Export history of versioned field

Today's new puzzle involves a user who has a list where one of the elements is a multiline text field with "Append text to existing entries" (i.e. versioned field) used for an Audit trail. If you open an individual item you can see all entries made in that field. The view for that column displays only a 'View Entries' link for that column which when you click it opens the item and jumps to that field. If you export the view to Excel it only exports the most recent entry in that field.

The user wants to export the view and get all entries in the field.

UPDATE 1: Found solution for displaying all entries in an "Append text..." field. The resolution is to use a DataView in Sharepoint Designer and look in the code for the entry for the field you;re interested in then locate a line that looks like:

<xsl:value-of select="@Audit_x0020_trail_x0020_comments" disable-output-escaping="yes"/>


Where, in this case, @Audit_x0020_trail_x0020_comments is the name of the field. Replace this line with:

<SharePoint:AppendOnlyHistory runat="server" FieldName="Audit_x0020_trail_x0020_comments" ControlMode="Display" ItemId="{@ID}"/ >


Note that I had to drop the @ symbol from the field name else I got an error about an unhandled exception due to an Object Reference not being set.

This left two issues, one of which we've solved (or at least worked around) and the other we have not (actually there's a third one of how to get this past my boss who is wary of allowing things that involve direct editing of the code but if it's the only way it's the only way).

The solved issue is how to get a Dataview created in Sharepoint designer into the list of available views (labelled 'Views') at the right hand end of the Sharepoint List toolbar. Our workaround is to create a regular public view in Sharepoint then edit the resulting .aspx file in Sharepoint designer (delete the existing view and insert a Dataview, don't forget to go into Dataview Properties and check the Sharepoint List Toolbar checkbox).

The as yet unresolved issue is that if you try to export a Dataview to Excel it will only export the ID column and will give a message about Hidden or Read-Only columns that require data but have no defaults. One of the people commenting on the above linked site also reported this problem. Interestingly if we just create a dataview in a blank page, rather than putting it on an existing list page we get a different error message ("Unexpected error...your data could not be saved") and nothing gets exported at all! This also happens when we create a view with just the most basic of fields and no customisations.

UPDATE 2:

Posted a question about this to a help forum: http://www.go4sharepoint.com/Forum/export-excel-dataview-export-id-column-22860.aspx

UPDATE 3:

Just tested with a different list on a different subsite, got exactly the same results so it looks like it's not related to the list we're using or the fields on it (this list is just a text field and a date).

UPDATE 4:

Posted a question about this on Microsoft Technet. Had a reply, and follow ups, from someone.

Wednesday 18 August 2010

Still looking for that elusive filter

Still looking for a way to filter a DataSource on a date column in WSS 3.0. All the references I can find seem to make one or more of the following assumptions:

  • You want to filter for items where the date is the current date, we're looking for 14 days ago

  • You can write the code yourself in C# and upload it to the server, we're on a hosted service so cannot

  • You are running MOSS (Microsoft Office Sharepoint Server), we're running WSS



I did find something that looked promising maybe using conditional formatting but it didn't work out.

Tuesday 17 August 2010

Ordering books

In the hope of gaining some knowledge of SharePoint I've ordered some books:


Really struggling with this limiting the report to items within the last 14 days, as previously posted it'd be no problem if it was just a regular view on a list (just filter on '[Today] - 14') but because it's a Data Source that won't work.

Monday 16 August 2010

Show items for last 14 days

The site I've been tasked with looking after (or more precisely supporting the guy who looks after it) has a few pages that are basically reports generated via via data sources (I think they're like a 'canned query' or View (in Oracle terms) but are an ASPX item on a page rather than SQL or something sane like that).

We had a request in to amend one of these so it only shows items created in the last 14 days, the report goes to a meeting every fortnight so anything over 14 days old will have been dealt with at the last meeting. Were these regular SharePoint views, no problem. Just add a filter on the Created column for greater then of equal to [Today]-14 and we'd be fine. Unfortunately the data source interface apparently doesn't know about [Today] or doing calculations in queries. There is a parameter called [CurrentDate] which appears to return the current date (like [Today]) but it doesn't seem to work in calculations.

I did some Google searching and found a page part way there. In this case they basically put a calendar control on the page and created a filter for Created greater or equal to that. Set that 14 days in the past and it will have the same effect, but not what the user wanted.

In the end we had to work around it by putting a calculated field on the list items for Created + 14 and check that [CurrentDate] is less than or equal to that. Works but messy.

Another Assignment, another blog

As readers of my other blogs have probably twigged every time I start using a new type of technology or app I start a blog about it to as a place to talk about issues and an aide memoire for stuff I've found.

I'm now looking after a Sharepoint site.