Email link to open InfoPath form in SharePoint

K

Ken K

My users have asked me to put a button on several IP forms which would email
selected users a message with a URL link to open the form which is on
SharePoint.
Ideally they want to log the messages sent out on the docuement.

I saw some code which is sort of the right idea on the Meeting Agenda sample
document but haven't been able to get it working on our form. The sample
code emails the whole form as an attachment where I need a url.

Any help or ideas would be appreciated. I have been searching for a sample
or something similar but no luck.
 
K

Ken K

My issue is slightly different in that my form is always on SharePoint.
I have some script that should solve part of what you are working on.
You have to use SP1 for this to work.
Go to the Tools menu, Data Connections.
Click Add... then "Submit data" then Next.
Click As an e-mail message then Next.
You will see the email form just put your address in the To field for now
and Finish.
Put some fields for To, Subject, and Intro on the form then put a button on
your form that will email the form.
On the button properites click Edit Form Code.
Where is says // Write your code here put the following code substituting
your field names for mine where you see the my:Fields.
Were mine says "SendMail" put the name you gave to your Data Connection.

var objEmail = XDocument.DataAdapters("SendMail");
objEmail.To = XDocument.DOM.selectSingleNode("//my:ToField").text;
objEmail.Subject = XDocument.DOM.selectSingleNode("//my:SubjectField").text;
objEmail.Intro = XDocument.DOM.selectSingleNode("//my:messageField").text;
objEmail.Submit();

Save your form and give it a try.
Good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top