Thanks for your reply..
I had another query for which i need a confirmed answer.
Query : I want to send an InfoPath form in the body of my email thru code.
//// CODE STARTS
public string sendMail()
{
// Create an InfoPath Application object.
Microsoft.Office.Interop.InfoPath.Application myApp = new Microsoft.Office.Interop.InfoPath.Application(); // ------------------------ ERROR 1
// Get a reference the XDocuments collection
// and open the sample form.
XDocumentsCollection myXDocs = myApp.XDocuments;
XDocument myXDoc = myXDocs.NewFromSolution(@\\ps2578\FormsForProTrack\EmailDataConnectionForm1.xsn); //---------------------- ERROR 2
myXDoc.SaveAs(@"\\ps2578\FormsForProTrack\Test1.xml");
myXDocs.Close(0);
myXDoc = myXDocs.Open(@"\\ps2578\FormsForProTrack\Test1.xml", (int)XdDocumentVersionMode.xdFailOnVersionOlder);
// Access the XML DOM for the underlying XML document using
// the DOM property. Note that you must cast to the
// IXMLDOMDocument2 type from the
// Microsoft.Office.Interop.InfoPath.Xml namespace
// to access the XML DOM.
IXMLDOMDocument2 myXMLDoc = myXDoc.DOM as IXMLDOMDocument2;
// Set the MSXML SelectionNamespaces property to the my
// namespace of the form. IMPORTANT:Replace the namespace
// with that of your sample form.
myXMLDoc.setProperty("SelectionNamespaces", "xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-08T08:28:17'");
IXMLDOMNode myXMLNode = myXMLDoc.selectSingleNode("//my:field1");
myXMLNode.text = "Mrudula";
EmailAdapter da = (EmailAdapter)myXDoc.DataAdapters["Email Submit"];
da.Submit();
// Save the updated form as Form2.xml and close out.
myXDoc.SaveAs(@"D:\MOSS\ProTrack\InfoPathForms\Test.xml");
myXDocs.Close(0);
myApp.Quit(false);
return ("Finished!");
} ///CODE ENDS
When i write this code in a web service, I get an error on the line which is marked as ERROR 1 in the above code
Error-
Retrieving the COM class factory for component with CLSID {8075635F-5146-11D5-A672-00B0D022E945} failed due to the following error: 80070005
When i write the same code in a class library and use the built DLL in my application i get an error on the line marked ERROR 2 but the code terminates after this line. So, i cannot capture the error message.
Also, please tell me whether i can send a mail having the embedded InfoPath form into it without using the EMAIL ADAPTER and MAIL ENVELOPE thru some CODE ? (preferrably C# code). I want to send the mail thru workflow.
Please reply soon since it is urgent.
Thanks and Regards,
Anandhi