Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Send email to SharePoint Group

  Asked By: Anushka Kotadia         Date: Apr 01, 2008      Category: Sharepoint      Views: 2703
 

I'm trying to email a SharePoint Group from within a
Workflow, built in Visual Studio. Simply passing the
group name into the "To" property doesn't work.

Anyone have any suggestions?

Tagged:          

 

3 Answers Found

 
Answer #1       Answered By: Rashawn Hopper          Answered On: Apr 01, 2008       

Just an idea, maybe you can use sharepoint  Object Model to find out
the members of the sharepoint group, then add each member's email  to
the To property.

 
Answer #2       Answered By: Horace Coffey          Answered On: Apr 01, 2008       

Yeah, that's the route I'm taking for now. I'm find
the SharePoint object model to be more complicated
than I anticipated.

 
Answer #3       Answered By: Rigoberto Beard          Answered On: Apr 01, 2008       

The WorkflowContext has a property  named Web that references the web
containing the list that is associated with the workflow. Using the
SPWeb object, you can get group  members. Below is sample code to list
members of a group. HTH.

string url = args[0];

string groupName = args[1];

using (SPSite site = new SPSite(url))

{

using (SPWeb web = site.OpenWeb())

{

SPGroup group = web.Groups[groupName];

Console.WriteLine(String.Format("Users in group '{0}' in site
'{1}'", group.Name, url));

foreach (SPUser user in group.Users)

{

Console.WriteLine(String.Format("{0}\t{1}", user.Name,
user.Email));

}

}

}

 
Didn't find what you were looking for? Find more on Send email to SharePoint Group Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].