email addresses from sharepoint list

T

Ted

I am trying to modify the default issue tracking formso that when you click
the send as email button the form will gather the email addresses from a
sharepoint list.

I am not a programmer so I am not sure how to do this.
 
T

Ted

Kalyan,
Most of that is foreign to me. Here is my code. Maybe someone can help me
figure out how to modify it.
function SendEmailBtn::OnClick(oEvent)
{
createEmail();
}



function createEmail()
{
var xmlContributors =
XDocument.DOM.selectNodes("/iss:issue/iss:contributors/iss:contributor");
var xmlContributor;
var xmlTitle = XDocument.DOM.selectSingleNode("/iss:issue/iss:title");
var rgRecipients = new Array();

while (xmlContributor = xmlContributors.nextNode())
rgRecipients.push(getNodeValue(xmlContributor.selectSingleNode("iss:emailAddressPrimary")));

try
{
var oEnvelope = XDocument.View.Window.MailEnvelope;

oEnvelope.To = rgRecipients.join("; ");
oEnvelope.Subject = getNodeValue(xmlTitle);
oEnvelope.Visible = true;
}
catch (ex)
{
XDocument.UI.Alert(ex.description);
}
}
 
S

S.Y.M. Wong-A-Ton

Do you have a SharePoint list as a Data Connection in your form? If you do,
it's just a matter of looping through all the email addresses in the list,
and composing a string by joining the email addresses with a semi-colon and
then using this string in the "To" field of your email message.
 
T

Ted

I do have a sharepoint list as a data connection. I am not sure how to loop
thgough the addresses and show to create the string or where to put it once
it is created. I see the to field in the code but not sure how to modify it
to make it loop the addresses from the list. How would I modify the code
below.

function createEmail()
{
var xmlContributors =
XDocument.DOM.selectNodes("/iss:issue/iss:contributors/iss:contributor");
var xmlContributor;
var xmlTitle = XDocument.DOM.selectSingleNode("/iss:issue/iss:title");
var rgRecipients = new Array();

while (xmlContributor = xmlContributors.nextNode())
rgRecipients.push(getNodeValue(xmlContributor.selectSingleNode("iss:emailAddressPrimary")));

try
{
var oEnvelope = XDocument.View.Window.MailEnvelope;

oEnvelope.To = rgRecipients.join("; ");
oEnvelope.Subject = getNodeValue(xmlTitle);
oEnvelope.Visible = true;
}
catch (ex)
{
XDocument.UI.Alert(ex.description);
}
 
S

S.Y.M. Wong-A-Ton

You need to take this one step at a time. Start by trying to get to the data
stored in your SharePoint data connection. Add something like the following
code at the beginning of the function:

var objSPSList =
XDocument.DataObjects["<Your_SharePoint_List_Data_Connection_Name>"].DOM;

XDocument.UI.Alert(objSPSList.xml);

What does the last line return?
 
T

Ted

I managed to get the emails to pull from a list on a sharepoint list but it
sends the file as an attachment. I want the form to be included in the body
of the message. How can I accomplish this?

S.Y.M. Wong-A-Ton said:
You need to take this one step at a time. Start by trying to get to the data
stored in your SharePoint data connection. Add something like the following
code at the beginning of the function:

var objSPSList =
XDocument.DataObjects["<Your_SharePoint_List_Data_Connection_Name>"].DOM;

XDocument.UI.Alert(objSPSList.xml);

What does the last line return?

---
S.Y.M. Wong-A-Ton


Ted said:
I do have a sharepoint list as a data connection. I am not sure how to loop
thgough the addresses and show to create the string or where to put it once
it is created. I see the to field in the code but not sure how to modify it
to make it loop the addresses from the list. How would I modify the code
below.

function createEmail()
{
var xmlContributors =
XDocument.DOM.selectNodes("/iss:issue/iss:contributors/iss:contributor");
var xmlContributor;
var xmlTitle = XDocument.DOM.selectSingleNode("/iss:issue/iss:title");
var rgRecipients = new Array();

while (xmlContributor = xmlContributors.nextNode())
rgRecipients.push(getNodeValue(xmlContributor.selectSingleNode("iss:emailAddressPrimary")));

try
{
var oEnvelope = XDocument.View.Window.MailEnvelope;

oEnvelope.To = rgRecipients.join("; ");
oEnvelope.Subject = getNodeValue(xmlTitle);
oEnvelope.Visible = true;
}
catch (ex)
{
XDocument.UI.Alert(ex.description);
}
 
S

S.Y.M. Wong-A-Ton

Currently not a feature in InfoPath, but will be available in next version
(see http://blogs.msdn.com/tudort/archive/2006/02/22/536800.aspx).

You can send the plain XML of the form in the Body of the message by setting
the Intro property on the EmailAdapter (see
http://msdn.microsoft.com/library/d...k/html/xdobjEmailAdapterObject_HV01106499.asp)
to XDocument.DOM.xml. I don't think the MailEnvelope object (as in your code)
supports this property.
---
S.Y.M. Wong-A-Ton


Ted said:
I managed to get the emails to pull from a list on a sharepoint list but it
sends the file as an attachment. I want the form to be included in the body
of the message. How can I accomplish this?

S.Y.M. Wong-A-Ton said:
You need to take this one step at a time. Start by trying to get to the data
stored in your SharePoint data connection. Add something like the following
code at the beginning of the function:

var objSPSList =
XDocument.DataObjects["<Your_SharePoint_List_Data_Connection_Name>"].DOM;

XDocument.UI.Alert(objSPSList.xml);

What does the last line return?

---
S.Y.M. Wong-A-Ton


Ted said:
I do have a sharepoint list as a data connection. I am not sure how to loop
thgough the addresses and show to create the string or where to put it once
it is created. I see the to field in the code but not sure how to modify it
to make it loop the addresses from the list. How would I modify the code
below.

function createEmail()
{
var xmlContributors =
XDocument.DOM.selectNodes("/iss:issue/iss:contributors/iss:contributor");
var xmlContributor;
var xmlTitle = XDocument.DOM.selectSingleNode("/iss:issue/iss:title");
var rgRecipients = new Array();

while (xmlContributor = xmlContributors.nextNode())
rgRecipients.push(getNodeValue(xmlContributor.selectSingleNode("iss:emailAddressPrimary")));

try
{
var oEnvelope = XDocument.View.Window.MailEnvelope;

oEnvelope.To = rgRecipients.join("; ");
oEnvelope.Subject = getNodeValue(xmlTitle);
oEnvelope.Visible = true;
}
catch (ex)
{
XDocument.UI.Alert(ex.description);
}

:

Do you have a SharePoint list as a Data Connection in your form? If you do,
it's just a matter of looping through all the email addresses in the list,
and composing a string by joining the email addresses with a semi-colon and
then using this string in the "To" field of your email message.
---
S.Y.M. Wong-A-Ton


:

I am trying to modify the default issue tracking formso that when you click
the send as email button the form will gather the email addresses from a
sharepoint list.

I am not a programmer so I am not sure how to do this.
 

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