SearchResult.Properties Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a ResultPropertyCollection collection of properties for this object.
public:
property System::DirectoryServices::ResultPropertyCollection ^ Properties { System::DirectoryServices::ResultPropertyCollection ^ get(); };
public System.DirectoryServices.ResultPropertyCollection Properties { get; }
member this.Properties : System.DirectoryServices.ResultPropertyCollection
Public ReadOnly Property Properties As ResultPropertyCollection
A ResultPropertyCollection of properties set on this object.
The following example is an excerpt of the example in SearchResult. The original example creates a new DirectoryEntry object with the desired path and uses the FindOne method to initiate the search. After performing the search, the example uses the GetDirectoryEntry method to retrieve the live directory entry that is identified in the search results.
In this example, the search result is put into a ResultPropertyCollection. Then, each property is displayed to the console window.
' Get the properties for 'mySearchResult'.
Dim myResultPropColl As ResultPropertyCollection
myResultPropColl = mySearchResult.Properties
Console.WriteLine("The properties of the 'mySearchResult' are :")
Dim myKey As String
For Each myKey In myResultPropColl.PropertyNames
Dim tab1 As String = " "
Console.WriteLine(myKey + " = ")
Dim myCollection As Object
For Each myCollection In myResultPropColl(myKey)
Console.WriteLine(tab1 + myCollection)
Next myCollection
Next myKey
// Get the properties for 'mySearchResult'.
ResultPropertyCollection myResultPropColl;
myResultPropColl = mySearchResult.Properties;
Console.WriteLine("The properties of the " +
"'mySearchResult' are :");
foreach( string myKey in myResultPropColl.PropertyNames)
{
string tab = " ";
Console.WriteLine(myKey + " = ");
foreach( Object myCollection in myResultPropColl[myKey])
{
Console.WriteLine(tab + myCollection);
}
}
// Get the properties for 'mySearchResult'.
ResultPropertyCollection^ myResultPropColl = mySearchResult->Properties;
Console::WriteLine("The properties of the 'mySearchResult' are :");
IEnumerator^ myEnum = myResultPropColl->PropertyNames->GetEnumerator();
while (myEnum->MoveNext())
{
String^ myKey = safe_cast<String^>(myEnum->Current);
Console::WriteLine("{0} = ", myKey);
IEnumerator^ myEnum = myResultPropColl->Item[myKey]->GetEnumerator();
while (myEnum->MoveNext())
{
Console::WriteLine("\t{0}", myEnum->Current);
}
}
This collection only contains properties that were explicitly requested through DirectorySearcher.PropertiesToLoad.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: