Click here to Skip to main content
15,900,973 members
Home / Discussions / C#
   

C#

 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
simpledeveloper14-Jul-20 10:33
simpledeveloper14-Jul-20 10:33 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
OriginalGriff14-Jul-20 10:58
mveOriginalGriff14-Jul-20 10:58 
AnswerRe: Padding a string with integers on its right keeping string length fixed Pin
#realJSOP15-Jul-20 0:40
professional#realJSOP15-Jul-20 0:40 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Richard Deeming15-Jul-20 3:30
mveRichard Deeming15-Jul-20 3:30 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
#realJSOP15-Jul-20 3:52
professional#realJSOP15-Jul-20 3:52 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Richard Deeming15-Jul-20 3:53
mveRichard Deeming15-Jul-20 3:53 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
#realJSOP15-Jul-20 3:57
professional#realJSOP15-Jul-20 3:57 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Richard Deeming15-Jul-20 4:09
mveRichard Deeming15-Jul-20 4:09 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
OriginalGriff15-Jul-20 5:21
mveOriginalGriff15-Jul-20 5:21 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Richard MacCutchan15-Jul-20 5:31
mveRichard MacCutchan15-Jul-20 5:31 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
OriginalGriff15-Jul-20 5:37
mveOriginalGriff15-Jul-20 5:37 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
#realJSOP15-Jul-20 23:45
professional#realJSOP15-Jul-20 23:45 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Daniel Pfeffer16-Jul-20 1:15
professionalDaniel Pfeffer16-Jul-20 1:15 
QuestionZkteco get device operation logs Pin
Member 1488936814-Jul-20 7:45
Member 1488936814-Jul-20 7:45 
AnswerRe: Zkteco get device operation logs Pin
OriginalGriff14-Jul-20 8:21
mveOriginalGriff14-Jul-20 8:21 
AnswerRe: Zkteco get device operation logs Pin
ZurdoDev15-Jul-20 6:16
professionalZurdoDev15-Jul-20 6:16 
QuestionTelegram.Bot doesn't invoke Bot.OnMessage Pin
SezzRS14-Jul-20 7:35
SezzRS14-Jul-20 7:35 
AnswerRe: Telegram.Bot doesn't invoke Bot.OnMessage Pin
ZurdoDev15-Jul-20 6:17
professionalZurdoDev15-Jul-20 6:17 
QuestionMessage Closed Pin
13-Jul-20 21:16
umeshamin13-Jul-20 21:16 
AnswerRe: Former English teacher solves a math problem with Python. Pin
Pete O'Hanlon13-Jul-20 21:22
mvePete O'Hanlon13-Jul-20 21:22 
AnswerRe: Former English teacher solves a math problem with Python. Pin
OriginalGriff13-Jul-20 21:50
mveOriginalGriff13-Jul-20 21:50 
QuestionActive Directory Question Pin
Kevin Marois13-Jul-20 10:15
professionalKevin Marois13-Jul-20 10:15 
I'm tryinig to recurse through the objects under a specific Organization Unit.
string domain = "LDAP://DC=MyCompany,DC=com";
string serverName = "192.168.30.10";
string ou = "OU=OrgUnit-Test-1,DC=MyCompany,DC=com";

I already know that under the OU above there are other OU's, Groups, and users. Each child OU can have groups and users, and each group can have users. It's a hierarchy of info that I want to interate over.

All the examples I'm finding are about finding users in groups and the like. What I'ds really like is some way of looping over some objects to examine them.

Here's an example I have that finds users in a specific group:
<pre>public List<ActiveDirectoryUser> GetAllUsersInGroup(string domainName, string groupName)
{
    List<ActiveDirectoryUser> results = new List<ActiveDirectoryUser>();

    using (var context = new PrincipalContext(ContextType.Domain, domainName))
    {
        using (var group = GroupPrincipal.FindByIdentity(context, groupName))
        {
            if (group != null)
            {
                var users = group.GetMembers(true).ToList();
                foreach (UserPrincipal user in users)
                {
                    var adu = new ActiveDirectoryUser(user.DisplayName, user.UserPrincipalName, user.GivenName, user.Surname, user.EmailAddress, user.Enabled.Value);
                    results.Add(adu);
                }
            }
        }
    }

    return results;
}
This works fine - if you know the group name.

Is there any way, given a starting OU, to examine all child objects under it? Again, I need to examine the entire hierarchy.

Thanks

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 13-Jul-20 16:37pm.

AnswerRe: Active Directory Question Pin
Richard Deeming13-Jul-20 22:25
mveRichard Deeming13-Jul-20 22:25 
GeneralRe: Active Directory Question Pin
Kevin Marois14-Jul-20 7:47
professionalKevin Marois14-Jul-20 7:47 
GeneralRe: Active Directory Question Pin
Richard Deeming14-Jul-20 23:04
mveRichard Deeming14-Jul-20 23:04 

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.