views:

466

answers:

2

I have been working on a document conversion feature for converting a docx file to a pdf file using MOSS 2007. The SPFile.Convert() call is being made in the ItemAdded event and the ItemFileConverted event is fired fine as well. The eventing seems to be working fine, but the IsConvertedFile and SourceLeafName properties of the converted SPFile instance are not always set by the conversion process. This is what I was attempting to use to determine if a call to SPFile.Convert should be made.

In digging into the code for SPFile IsConvertedFile, GeneratingConverterId and SourceLeafName properties, it seems these are based on SPFile.Properties "vti_dttransformerid" and "vti_dtparentleafname". The problem is, these two properties are not being set consistently whenever I have code in my ISPConversionProcessor.PostProcess() implementation in which I was hoping to do some post processing of the file. If there is no code in the PostProcess method (only the runDefaultPostProcessing = true; statement) the properties are set more consistently.

I have some additional details here in a Wiki pageabout what is going on, but using .NET Reflector to determine where these fields are updated from hit a brick wall at OWSTIMER.EXE (I could find all of the reads for the properties, but even the HtmlLauncher and LoadBalancer services had no mention of these properties).

Has anyone done a complete Document Conversion implmentation and used the SPFile.IsConvertedFile and SPFile.SourceLeafName properties successfully?

A: 

I have created a PDF Converter for SharePoint, but didn't use the Document Converter functionality as it didn't match our needs and was not flexible enough.

Not sure if this reply will be thrown out as spam as I am now going to link you to the place where you can download a free trial version. Download PDF Converter for SharePoint.

I feel a bit dirty now, but I may have actually helped you ;-)

Muhimbi
A: 

If you can't trust the API, store the IsConverted metadata in the property bag for the SPListItem. Or if you prefer to show it in the UI, add another field to your list. This should all work fine from the event handler.

It's annoying to do the extra work but I guess there might be additional metadata that you can add which SPFile wouldn't have been able to provide anyway.

Alex Angas
Thanks Alex. In the end this is what I ended up doing. The Properties stores a value that lets me determine the converted status.
Pete Skelly