User.GetPermissionQueryIterator Method

Definition

Overloads

GetPermissionQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

This method creates a query for permissions under a database using a SQL statement with parameterized values. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetPermissionQueryIterator<T>(String, String, QueryRequestOptions)

This method creates a query for permission under a user using a SQL statement. It returns a FeedIterator.

GetPermissionQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

Source:
User.cs

This method creates a query for permissions under a database using a SQL statement with parameterized values. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetPermissionQueryIterator<T> (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetPermissionQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
Public MustOverride Function GetPermissionQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)

Type Parameters

T

Parameters

queryDefinition
QueryDefinition

The cosmos SQL query definition.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the user query request QueryRequestOptions

Returns

An iterator to go through the permissions

Examples

This create the type feed iterator for permissions with queryDefinition as input.

QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM c where c.status like @status")
    .WithParameter("@status", "start%");
using (FeedIterator<PermissionProperties> resultSet = this.user.GetPermissionQueryIterator<PermissionProperties>(queryDefinition))
{
    while (feedIterator.HasMoreResults)
    {
        foreach (PermissionProperties properties in await feedIterator.ReadNextAsync())
        {
            Console.WriteLine(properties.Id);
        }
    }
}

Remarks

Reading permissions will generate a new ResourceTokens. Prior ResourceTokens will still be valid.

Applies to

GetPermissionQueryIterator<T>(String, String, QueryRequestOptions)

Source:
User.cs

This method creates a query for permission under a user using a SQL statement. It returns a FeedIterator.

public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetPermissionQueryIterator<T> (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetPermissionQueryIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
Public MustOverride Function GetPermissionQueryIterator(Of T) (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)

Type Parameters

T

Parameters

queryText
String

The cosmos SQL query text.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the user query request QueryRequestOptions

Returns

An iterator to go through the permission

Examples

  1. This create the type feed iterator for permission with queryText as input,
string queryText = "SELECT * FROM c where c.status like 'start%'";
using (FeedIterator<PermissionProperties> feedIterator = this.users.GetPermissionQueryIterator<PermissionProperties>(queryText))
{
    while (feedIterator.HasMoreResults)
    {
        FeedResponse<PermissionProperties> response = await feedIterator.ReadNextAsync();
        foreach (var permission in response)
        {
            Console.WriteLine(permission);
        }
    }
}
  1. This create the type feed iterator for permissions without queryText, retrieving all permissions.
using (FeedIterator<PermissionProperties> feedIterator = this.user.GetPermissionQueryIterator<PermissionProperties>())
{
    while (feedIterator.HasMoreResults)
    {
        FeedResponse<PermissionProperties> response = await feedIterator.ReadNextAsync();
        foreach (var permission in response)
        {
            Console.WriteLine(permission);
        }
    }
}

Applies to