i have the conversion code for converting from infopath to HTML
Guid id;
var conversionResults = newItem.Convert(new Guid("853d58f5-13c3-46f8-8b81-3ca4abcad7b3"), Path.GetFileNameWithoutExtension(newItem.Name), null, "Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.InfoPath.Server.DocumentConversion", 1, String.Empty, false, true, out id);
Which i got from using the msdn convert http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.convert.aspx and general documentation around the subject but whenever i try to run it i get the exception
Could not load type 'Microsoft.Office.InfoPath.Server.DocumentConversion' from assembly 'Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.
at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.SharePoint.Administration.SPDocumentTransformDriver.GetTransformProcessor(ExecutingTransformRequest etr)
at Microsoft.SharePoint.Administration.SPDocumentTransformDriver.Transform(SPWebApplication wa, ExecutingTransformRequest etr)
at Microsoft.SharePoint.SPFile.Convert(Guid ConverterId, String newFileName, String configInfo, String handlerAssembly, String handlerClass, Byte priority, String peopleToAlert, Boolean sendACopy, Boolean synchronous, Guid& workItemId)
at RMS.FormServices.ConvertInfopathToASPX(String infopathFile, String fileNamingbasedon) in C:\Documents and Settings\UN\Source Control\Project\FormServices.asmx.cs:line 243
If i change it to
Guid id;
var conversionResults = newItem.Convert(new Guid("853d58f5-13c3-46f8-8b81-3ca4abcad7b3"), Path.GetFileNameWithoutExtension(newItem.Name), null, "Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.InfoPath.Server.DocumentConversion", 1, String.Empty, false, false, out id);
it returns success however if i then try
var converted = newItem.GetConvertedFile(id);
it throws a exception and if i try
while (true)
{
var state = newItem.GetConversionState(new Guid("853d58f5-13c3-46f8-8b81-3ca4abcad7b3"), id);
if (state == SPFileConversionState.Completed)
break;
}
then state hits pending, then after a while available state and never changes after that, ive been trying to get this code working for ages and any help would be appreciated
just as a side note, the convert Infopath to HTML is enabled on the sharepoint server, its all configured and it works from sharepoint (very slowly though) i just cant get it working from the code.
Edit: Some futher information after looking at the logs and with the conversion code looking like
var conversionResults = newItem.Convert(new Guid("853d58f5-13c3-46f8-8b81-3ca4abcad7b3"), Path.GetFileNameWithoutExtension(newItem.Name), null, null, null, 1, String.Empty, false, true, out id);
the conversion fails and the following shows up in the logs
08/02/2011 14:53:42.83 Microsoft.Office.Server.Convers (0x04FC) 0x06BC Document Conversions Launcher Service 7jg8 Verbose Calling LoadBalancer.RegisterLauncher
08/02/2011 14:53:42.86 Microsoft.Office.Server.Convers (0x0538) 0x0CBC Document Conversions Load Balancer Service 7jhf Medium RegisterLauncher called with uri http://SEED-DEV8:8082/HtmlTrLauncher
08/02/2011 14:53:42.86 Microsoft.Office.Server.Convers (0x0538) 0x0CBC Document Conversions Load Balancer Service 7jht Verbose LoadList: Add Called: http://SEED-DEV8:8082/HtmlTrLauncher, 0 08/02/2011 14:53:42.86 Microsoft.Office.Server.Convers (0x0538) 0x0CBC Document Conversions Load Balancer Service 7jhu Verbose (note: expected after EnsureLoadBalancerStatus call) register launcher called for uri that's already registered: http://SEED-DEV8:8082/HtmlTrLauncher 08/02/2011 14:53:42.88 Microsoft.Office.Server.Convers (0x04FC) 0x06BC Document Conversions Launcher Service 7jg9 Verbose LoadBalancer.RegisterLauncher succesful 08/02/2011 14:53:42.81 Microsoft.Office.Server.Convers (0x04FC) 0x06BC Document Conversions Launcher Service 7jdv Verbose EnsureLoadBalancerStatus called
Edit 2: i changed the max size for the converter and it is running a lot faster now from both code and sharepoint but the conversion code is still not working and just comming up as failure. the Log for the converter can be found here (everything from the start of the convert code till the end)