Assign WSS Document Parser to specific Extension

The other day I was working with some excel documents within SharePoint 3.0 and I’ve noticed the excel template files do OLE properties do not get promoted into SPListItem properties. After some digging around I’ve found that the excel template extension *.XLT is not assigned to the default SharePoint office document parser.

The solution was somewhat harder to find, but finally I found this on the net:

SPFarm farm = SPFarm.Local;

SPWebService service = farm.Services.GetValue<SPWebService>();

SPDocumentParser customParser = new SPDocumentParser(“SharePoint.SPDocumentParser.OfficeParser”, “xlt”);

service.PluggableParsers.Add(“xlt”, customParser);

service.Update();

The *.XLT extension assignmentto the OfficParser is done at farm level. After running this code, all excel template files uploaded to SharePoint get their OLE properties promoted into SPListItem properties bag, as described in the WSS SDK custom document parsers section.

This solved the *.XLT problem, but shortly another one was revealed: the OfficeParser seems to promote only string type OLE properties, and OLE fields with float and DateTime types are ignored. I hope to get back to this problem when I’ll know more.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: