Skip to content

Commit 2a60907

Browse files
author
Ron Petrusha
authored
Corrected badly formed string, bad code IDs (#2542)
* Corrected badly formed string, bad code IDs * fix additional langid
1 parent 458ed19 commit 2a60907

File tree

2 files changed

+32
-43
lines changed

2 files changed

+32
-43
lines changed

xml/System.DirectoryServices/DirectoryEntry.xml

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ Public Class PrintChildren
172172
Next objChildDE
173173
End Sub 'Main
174174
End Class 'PrintChildren
175-
176175
```
177176
178177
```csharp
@@ -190,10 +189,9 @@ public class PrintChildren{
190189
Console.WriteLine(objChildDE.Path);
191190
}
192191
}
193-
194192
```
195193
196-
```cpp#
194+
```cpp
197195
int main()
198196
{
199197
String^ args[] = Environment::GetCommandLineArgs();
@@ -214,7 +212,6 @@ int main()
214212
Console::WriteLine(objChildDE->Path);
215213
}
216214
}
217-
218215
```
219216
220217
]]></format>
@@ -680,7 +677,6 @@ If DirectoryEntry.Exists(myADSPath) Then
680677
Else
681678
Console.WriteLine("The path {0} is invalid",myADSPath)
682679
End If
683-
684680
```
685681
686682
```csharp
@@ -695,10 +691,9 @@ if (DirectoryEntry.Exists(myADSPath))
695691
{
696692
Console.WriteLine("The path {0} is invalid",myADSPath);
697693
}
698-
699694
```
700695
701-
```cpp#
696+
```cpp
702697
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
703698
// Determine whether the given path is correct for the DirectoryEntry.
704699
if (DirectoryEntry::Exists(myADSPath))
@@ -709,7 +704,6 @@ else
709704
{
710705
Console::WriteLine("The path {0} is invalid", myADSPath);
711706
}
712-
713707
```
714708
715709
]]></format>
@@ -766,7 +760,6 @@ Dim myDirectoryEntry As New DirectoryEntry(myADSPath)
766760
' Display the Guid and NativeGuid.
767761
Console.WriteLine("The GUID of the ADS object:" + myDirectoryEntry.Guid.ToString)
768762
Console.WriteLine("The Native GUID of the ADS" + "object:" + myDirectoryEntry.NativeGuid)
769-
770763
```
771764
772765
```csharp
@@ -778,18 +771,16 @@ Console.WriteLine("The GUID of the ADS object:"+
778771
myDirectoryEntry.Guid);
779772
Console.WriteLine("The Native GUID of the ADS"+
780773
"object:"+myDirectoryEntry.NativeGuid);
781-
782774
```
783775
784-
```cpp#
776+
```cpp
785777
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
786778
DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
787779
788780
// Display the Guid and NativeGuid.
789781
Console::WriteLine("The GUID of the ADS object: {0}", myDirectoryEntry->Guid);
790782
Console::WriteLine("The Native GUID of the ADS object: {0}",
791783
myDirectoryEntry->NativeGuid);
792-
793784
```
794785
795786
]]></format>
@@ -1091,10 +1082,9 @@ foreach(DirectoryEntry myDirectoryEntryChild in
10911082
{
10921083
Console.WriteLine(myDirectoryEntryChild.Path);
10931084
}
1094-
10951085
```
10961086
1097-
```cpp#
1087+
```cpp
10981088
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
10991089
DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
11001090
@@ -1181,10 +1171,9 @@ Console.WriteLine("The GUID of the ADS object:"+
11811171
myDirectoryEntry.Guid);
11821172
Console.WriteLine("The Native GUID of the ADS"+
11831173
"object:"+myDirectoryEntry.NativeGuid);
1184-
11851174
```
11861175
1187-
```cpp#
1176+
```cpp
11881177
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
11891178
DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
11901179
@@ -1362,7 +1351,6 @@ Dim myADSPath As String = _
13621351
Dim myDirectoryEntry As New DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword)
13631352
13641353
Console.WriteLine("Parent is :" + myDirectoryEntry.Parent.Path)
1365-
13661354
```
13671355
13681356
```csharp
@@ -1372,12 +1360,11 @@ DirectoryEntry myDirectoryEntry=new DirectoryEntry(myADSPath, UserName, Securely
13721360
Console.WriteLine("Parent is :"+myDirectoryEntry.Parent.Path);
13731361
```
13741362
1375-
```cpp#
1363+
```cpp
13761364
String^ myADSPath = "LDAP://onecity/CN=user,CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
13771365
DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);
13781366
13791367
Console::WriteLine("Parent is :{0}", myDirectoryEntry->Parent->Path);
1380-
13811368
```
13821369
13831370
]]></format>
@@ -1458,10 +1445,9 @@ myDirectoryEntry.Password = SecurelyStoredPassword;
14581445
Console.WriteLine("The Child ADS objects are:");
14591446
foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
14601447
Console.WriteLine(myChildDirectoryEntry.Path);
1461-
14621448
```
14631449
1464-
```cpp#
1450+
```cpp
14651451
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
14661452
14671453
// Create an Instance of DirectoryEntry.
@@ -1478,7 +1464,6 @@ while (myEnum->MoveNext())
14781464
(myEnum->Current);
14791465
Console::WriteLine(myChildDirectoryEntry->Path);
14801466
}
1481-
14821467
```
14831468
14841469
]]></format>
@@ -1830,10 +1815,9 @@ if (string.Compare(mySchemaEntry.Name, "container") == 0)
18301815
foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
18311816
Console.WriteLine(myChildDirectoryEntry.Path);
18321817
}
1833-
18341818
```
18351819
1836-
```cpp#
1820+
```cpp
18371821
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
18381822
18391823
// Creates an Instance of DirectoryEntry.
@@ -1854,7 +1838,6 @@ if (!String::Compare(mySchemaEntry->Name, "container"))
18541838
Console::WriteLine(myChildDirectoryEntry->Path);
18551839
}
18561840
}
1857-
18581841
```
18591842
18601843
]]></format>
@@ -1947,7 +1930,7 @@ if (string.Compare(mySchemaEntry.Name,"container") == 0)
19471930
19481931
```
19491932
1950-
```cpp#
1933+
```cpp
19511934
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
19521935
19531936
// Creates an Instance of DirectoryEntry.
@@ -1968,7 +1951,6 @@ if (!String::Compare(mySchemaEntry->Name, S"container"))
19681951
Console::WriteLine(myChildDirectoryEntry->Path);
19691952
}
19701953
}
1971-
19721954
```
19731955
19741956
]]></format>
@@ -2108,10 +2090,9 @@ myDirectoryEntry.Password = SecurelyStoredPassword;
21082090
Console.WriteLine("The Child ADS objects are:");
21092091
foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
21102092
Console.WriteLine(myChildDirectoryEntry.Path);
2111-
21122093
```
21132094
2114-
```cpp#
2095+
```cpp
21152096
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
21162097
21172098
// Create an Instance of DirectoryEntry.
@@ -2127,7 +2108,6 @@ while (myEnum->MoveNext())
21272108
DirectoryEntry^ myChildDirectoryEntry = safe_cast<DirectoryEntry^>(myEnum->Current);
21282109
Console::WriteLine(myChildDirectoryEntry->Path);
21292110
}
2130-
21312111
```
21322112
21332113
]]></format>
@@ -2136,4 +2116,4 @@ while (myEnum->MoveNext())
21362116
</Docs>
21372117
</Member>
21382118
</Members>
2139-
</Type>
2119+
</Type>

xml/System.DirectoryServices/DirectorySearcher.xml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -546,19 +546,28 @@ SearchResultCollection res = src.FindAll();
546546
The following example shows how to use the <xref:System.DirectoryServices.DirectorySearcher.AttributeScopeQuery%2A> property with the member attribute to get the members of a group. It then prints out the first and last names of the members and their telephone numbers.
547547
548548
```csharp
549+
using System;
549550
using System.DirectoryServices;
550-
DirectoryEntry group = new DirectoryEntry("LDAP://CN=MyGroup, …");
551-
DirectorySearcher src = new DirectorySearcher(group "(&(objectClass=user)(objectCategory=Person))");
552-
src.AttributeScopedQuery = "member";
553-
src.PropertiesToLoad.Add("sn");
554-
src.PropertiesToLoad.Add("givenName");
555-
src.PropertiesToLoad.Add("telephoneNumber");
556-
foreach(SearchResult res in src.FindAll())
557-
{
558-
Console.WriteLine("…");
559-
}
560-
```
561-
551+
552+
public class Example
553+
{
554+
public static void Main()
555+
{
556+
DirectoryEntry group = new DirectoryEntry("LDAP://CN=MyGroup", …);
557+
DirectorySearcher src = new DirectorySearcher("(&(objectClass=user)(objectCategory=Person))");
558+
src.AttributeScopeQuery = "member";
559+
src.PropertiesToLoad.Add("sn");
560+
src.PropertiesToLoad.Add("givenName");
561+
src.PropertiesToLoad.Add("telephoneNumber");
562+
563+
foreach(SearchResult res in src.FindAll())
564+
{
565+
Console.WriteLine("…");
566+
}
567+
}
568+
}
569+
```
570+
562571
]]></format>
563572
</remarks>
564573
<exception cref="T:System.ArgumentException">The <see cref="P:System.DirectoryServices.DirectorySearcher.SearchScope" /> property is set to a value other than <see cref="F:System.DirectoryServices.SearchScope.Base" />.</exception>

0 commit comments

Comments
 (0)