I was searching for sending Mail from Infopath form, on click of button through custom code.
Initially I tried this by googling,
EmailAdapterObject myEmailAdapter =
((EmailAdapterObject)thisXDocument.DataAdapters["Email Submit Internal"]);
myEmailAdapter.To = list@example.com;
myEmailAdapter.Subject = "Status Report";
myEmailAdapter.Submit();
But in above code, I was not able to get "thisXDocument" reference.
Then I used below code to send Email
Microsoft.Office.Interop.Outlook.Application objOutlook = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem objOutlookMsg = (MailItem)objOutlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
objOutlookMsg.To = " To Address ";
//objOutlookMsg.CC = AddressCC;
//objOutlookMsg.BCC = AddressBCC;
objOutlookMsg.Subject = "TestMail";
objOutlookMsg.Body = "Body of email";
// If you want to attach image
objOutlookMsg.Attachments.Add(@"\image\header.jpg", Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, objOutlookMsg.Body.Length + 1, "My Attachment");
objOutlookMsg.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceNormal;
//objOutlookMsg.Display(true);
objOutlookMsg.Send();
objOutlook = null;
objOutlookMsg = null;
Wednesday, September 29, 2010
InfoPath 2010 : How to make Text fields Visible False
I was just trying to figure our, how can we make the fields visible false in Infopath designer 2010.
I didnot find any direct way, but what we can do is, while designing, create textfield, appropriate field name will get create under "MYfields". Later delete the Text field from UI, but stil you can work with the fields declared under "MyFields".
I didnot find any direct way, but what we can do is, while designing, create textfield, appropriate field name will get create under "MYfields". Later delete the Text field from UI, but stil you can work with the fields declared under "MyFields".
Wednesday, September 15, 2010
Infopath 2010 - Error while connecting to Web service
I was trying to populate data in Infopath form by calling webservice .
I was getting below error when I try to call webservice through code.
Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
After doing so many R&D, I found this can be solved by adding "Full" trust in Web.config, but in Infopath project, we won't get Web.config file. We have only App.Config file.
After searching in Infopath Form, where you can set Full Trust.
Open Infopath 2010 form in Design Mode.
Click on Langauge Tab.
I was getting below error when I try to call webservice through code.
Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
After doing so many R&D, I found this can be solved by adding "Full" trust in Web.config, but in Infopath project, we won't get Web.config file. We have only App.Config file.
After searching in Infopath Form, where you can set Full Trust.
Open Infopath 2010 form in Design Mode.
Click on Langauge Tab.
Under Security and Trust - Select Full Trust option.
This will solve your problem
Monday, September 6, 2010
Error while opening Infopath file
When I was trying to open Infopath file (.xsn) , I was getting below error.
This form cannot be opened because it requires the domain permission level
Error Details:
Forms that require the domain permission level contain features
that access information on a network, such as data connections, linked images, and code.
The solution for this is very simple.
Right click on the file, select "Design" option. this will work
This form cannot be opened because it requires the domain permission level
Error Details:
Forms that require the domain permission level contain features
that access information on a network, such as data connections, linked images, and code.
The solution for this is very simple.
Right click on the file, select "Design" option. this will work
Subscribe to:
Posts (Atom)