共用方式為


SPClaimProvider.EntityTypesContain Method

Checks the entity type.

Namespace:  Microsoft.SharePoint.Administration.Claims
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Protected Shared Function EntityTypesContain ( _
    entityTypes As String(), _
    requestedEntityType As String _
) As Boolean
'Usage
Dim entityTypes As String()
Dim requestedEntityType As String
Dim returnValue As Boolean

returnValue = SPClaimProvider.EntityTypesContain(entityTypes, _
    requestedEntityType)
protected static bool EntityTypesContain(
    string[] entityTypes,
    string requestedEntityType
)

Parameters

  • entityTypes
    Type: []

    The entity type set that are passed to the requested operation such as the FillResolve() method.

  • requestedEntityType
    Type: System.String

    The entity type that this operation is checking the entityTypes parameter for.

Return Value

Type: System.Boolean
true if the entity type contains the requested entity type; otherwise, false.

Remarks

The following first code snippet example shows how to use this method if you did not use a custom entity type. Let’s say, you use forms roles. Therefore, if the picker is not asking for forms roles, then your search and resolve methods should not get involved. For example if the picker is configured to just return distribution lists and not form roles then your claims provider should not be returning data.

The second code snippet shows an example with is a custom entity type.

Examples

if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole))
      return;

private bool DoesEntityTypesContainMyCustomType(String[] entityTypes)
        {
            bool result = false;

            result = EntityTypesContain(entityTypes, MyEntityType);

            return result;
        }

See Also

Reference

SPClaimProvider Class

SPClaimProvider Members

Microsoft.SharePoint.Administration.Claims Namespace