Click here to Skip to main content
15,886,801 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How do we find out During Month transactions took place in our Database. Pin
Rod Kemp12-Mar-10 1:28
Rod Kemp12-Mar-10 1:28 
QuestionTextbox Pin
FEMDEV11-Mar-10 23:14
FEMDEV11-Mar-10 23:14 
AnswerRe: Textbox Pin
ademsandeepreddy12-Mar-10 1:00
ademsandeepreddy12-Mar-10 1:00 
QuestionDrop Dwown list item disabling using javascript Pin
Jinoju11-Mar-10 18:21
Jinoju11-Mar-10 18:21 
AnswerRe: Drop Dwown list item disabling using javascript Pin
R. Giskard Reventlov11-Mar-10 21:16
R. Giskard Reventlov11-Mar-10 21:16 
AnswerRe: Drop Dwown list item disabling using javascript Pin
koolprasad200312-Mar-10 1:54
professionalkoolprasad200312-Mar-10 1:54 
AnswerRe: Drop Dwown list item disabling using javascript Pin
saanj19-Mar-10 0:01
saanj19-Mar-10 0:01 
QuestionHow do I get the emails of all the members of a given group in ActiveDirectory - Need help Pin
Slow Learner11-Mar-10 15:34
Slow Learner11-Mar-10 15:34 
Hi,

I have a need to send out emails to all the people who are in a given group say "HR Department". I need to be able to get all the emails through a for loop and then as it retrieves I should send emails to them. Can some one please help me with the code how to get the emails out of AD.

this is what I came up with but not sure how to go about writing a for loop to get all the emails in the given group. I am having difficulty to send both the loginName and the group that I am interested in to the AD in the search.Filter.


public static string SendEmails(string loginName)
{

string Department = "HR Department"
string userName = ExtractUserName(loginName);
DirectorySearcher search = new DirectorySearcher();
search.Filter = String.Format("(SAMAccountName={0})", userName);
//search.Filter = String.Format("(SAMAccountName={FAY ImprovmentForm})", userName);
//LdapSearcher.Filter = string.Format("(&(objectClass=user)(department={0}))", Department);
//search.Filter = string.Format("(&(objectClass=group)(SAMAccountName=" + Department + "))", userName);
search.PropertiesToLoad.Add("cn");
search.PropertiesToLoad.Add("samaccountname");
search.PropertiesToLoad.Add("givenname");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("mail");
SearchResult result = search.FindOne();
string samaccountname = (string)result.Properties["samaccountname"][0];
string givenname = (string)result.Properties["givenname"][0];
string surname = (string)result.Properties["sn"][0];
string email = (string)result.Properties["mail"][0];

if (result == null)
{
return "User doesn't Exist";
}
else
{
return "Emails sent successfully!";
}
AnswerRe: How do I get the emails of all the members of a given group in ActiveDirectory - Need help Pin
Abhijit Jana11-Mar-10 19:27
professionalAbhijit Jana11-Mar-10 19:27 
QuestionDataGrid Horizontal ScrollBar not working on Windows Server 2003 Pin
nachiket0711-Mar-10 15:20
nachiket0711-Mar-10 15:20 
AnswerRe: DataGrid Horizontal ScrollBar not working on Windows Server 2003 Pin
Abhijit Jana11-Mar-10 20:17
professionalAbhijit Jana11-Mar-10 20:17 
GeneralRe: DataGrid Horizontal ScrollBar not working on Windows Server 2003 Pin
nachiket0711-Mar-10 20:30
nachiket0711-Mar-10 20:30 
QuestionJavaScript Problem - need help!!! Pin
AndyASPVB11-Mar-10 9:23
AndyASPVB11-Mar-10 9:23 
AnswerRe: JavaScript Problem - need help!!! Pin
T M Gray11-Mar-10 10:15
T M Gray11-Mar-10 10:15 
AnswerRe: JavaScript Problem - need help!!! Pin
Not Active11-Mar-10 10:15
mentorNot Active11-Mar-10 10:15 
GeneralRe: JavaScript Problem - need help!!! Pin
AndyASPVB11-Mar-10 11:06
AndyASPVB11-Mar-10 11:06 
GeneralRe: JavaScript Problem - need help!!! Pin
Not Active11-Mar-10 12:00
mentorNot Active11-Mar-10 12:00 
GeneralRe: JavaScript Problem - need help!!! Pin
AndyASPVB11-Mar-10 21:46
AndyASPVB11-Mar-10 21:46 
Questionaspx pages are not able to browse from IIS Pin
getaccessyr11-Mar-10 2:56
getaccessyr11-Mar-10 2:56 
AnswerRe: aspx pages are not able to browse from IIS Pin
Dinesh Mani11-Mar-10 3:09
Dinesh Mani11-Mar-10 3:09 
AnswerRe: aspx pages are not able to browse from IIS Pin
Pranay Rana11-Mar-10 3:14
professionalPranay Rana11-Mar-10 3:14 
AnswerRe: aspx pages are not able to browse from IIS Pin
saanj19-Mar-10 0:03
saanj19-Mar-10 0:03 
QuestionRestricting access to a WebMethod Pin
Rahul Babu11-Mar-10 2:11
Rahul Babu11-Mar-10 2:11 
AnswerRe: Restricting access to a WebMethod Pin
Vimalsoft(Pty) Ltd11-Mar-10 3:22
professionalVimalsoft(Pty) Ltd11-Mar-10 3:22 
QuestionPrivate WebMethod Pin
Rahul Babu11-Mar-10 2:05
Rahul Babu11-Mar-10 2:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.