DirectorySearcher.AttributeScopeQuery プロパティ

定義

検索対象とする識別名の属性の LDAP 表示名を取得または設定します。 この種類の検索では 1 つの属性だけを使用できます。

public:
 property System::String ^ AttributeScopeQuery { System::String ^ get(); void set(System::String ^ value); };
public string AttributeScopeQuery { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.DirectoryServices.DSDescription("DSAttributeQuery")]
[System.Runtime.InteropServices.ComVisible(false)]
public string AttributeScopeQuery { get; set; }
[System.DirectoryServices.DSDescription("DSAttributeQuery")]
[System.Runtime.InteropServices.ComVisible(false)]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string AttributeScopeQuery { get; set; }
member this.AttributeScopeQuery : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
[<System.DirectoryServices.DSDescription("DSAttributeQuery")>]
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.AttributeScopeQuery : string with get, set
[<System.DirectoryServices.DSDescription("DSAttributeQuery")>]
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.AttributeScopeQuery : string with get, set
Public Property AttributeScopeQuery As String

プロパティ値

検索の実行対象となる属性の LDAP 表示名。または属性のスコープのクエリが設定されていない場合は空の文字列。

属性

例外

SearchScope プロパティは、Base 以外の値に設定されています。

次の例では、 プロパティと member 属性を使用 AttributeScopeQuery してグループのメンバーを取得する方法を示します。 その後、メンバーの姓と姓と電話番号が出力されます。

using System;
using System.DirectoryServices;  

public class Example
{
    public static void Main()
    {
        DirectoryEntry group = new DirectoryEntry("LDAP://CN=MyGroup", …);        
        DirectorySearcher src = new DirectorySearcher("(&(objectClass=user)(objectCategory=Person))");      
        src.SearchRoot = group;
        src.AttributeScopeQuery = "member";  
        src.PropertiesToLoad.Add("sn");
        src.PropertiesToLoad.Add("givenName");  
        src.PropertiesToLoad.Add("telephoneNumber");  

        foreach(SearchResult res in src.FindAll())  
        {  
            Console.WriteLine("…");  
        }
    }
}

注釈

このプロパティが に設定される属性は、member や managedBy などの識別名属性である必要があります。 属性には、単一値または複数値を指定できます。 詳細については、「 メンバー 」および「 マネージド バイ 」の記事を参照してください。

検索は、基本オブジェクトの 属性で指定された識別名で識別されるオブジェクトに対して実行されます。 たとえば、基本オブジェクトが adschema グループ クラスで、 AttributeScopeQuery が "member" に設定されている場合、検索はグループのメンバーであるすべてのオブジェクトに対して実行されます。 詳細については、 グループ クラス に関する記事を参照してください。

プロパティを AttributeScopeQuery 使用する場合は、 プロパティを SearchScope に設定する Base必要があります。 プロパティが他の SearchScope 値に設定されている場合、 プロパティを AttributeScopeQuery 設定すると が ArgumentExceptionスローされます。

詳細については、「 属性スコープ クエリの実行」を参照してください。

適用対象