Compartilhar via


DevCenterClient.GetProjects Method

Definition

Overloads

GetProjects(RequestContext)

[Protocol Method] Lists all projects.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
  • Please try the simpler GetProjects(CancellationToken) convenience overload with strongly typed models first.
GetProjects(CancellationToken)

Lists all projects.

GetProjects(String, Nullable<Int32>, RequestContext)

[Protocol Method] Lists all projects.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.

GetProjects(RequestContext)

Source:
DevCenterClient.cs

[Protocol Method] Lists all projects.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
  • Please try the simpler GetProjects(CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Pageable<BinaryData> GetProjects (Azure.RequestContext context);
abstract member GetProjects : Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetProjects : Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetProjects (context As RequestContext) As Pageable(Of BinaryData)

Parameters

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetProjects and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

foreach (BinaryData item in client.GetProjects(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
}

This sample shows how to call GetProjects with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

foreach (BinaryData item in client.GetProjects(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString());
}

Applies to

GetProjects(CancellationToken)

Source:
DevCenterClient.cs

Lists all projects.

public virtual Azure.Pageable<Azure.Developer.DevCenter.Models.DevCenterProject> GetProjects (System.Threading.CancellationToken cancellationToken = default);
abstract member GetProjects : System.Threading.CancellationToken -> Azure.Pageable<Azure.Developer.DevCenter.Models.DevCenterProject>
override this.GetProjects : System.Threading.CancellationToken -> Azure.Pageable<Azure.Developer.DevCenter.Models.DevCenterProject>
Public Overridable Function GetProjects (Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of DevCenterProject)

Parameters

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetProjects.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

foreach (DevCenterProject item in client.GetProjects())
{
}

This sample shows how to call GetProjects with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

foreach (DevCenterProject item in client.GetProjects())
{
}

Applies to

GetProjects(String, Nullable<Int32>, RequestContext)

Source:
DevCenterClient.cs

[Protocol Method] Lists all projects.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Pageable<BinaryData> GetProjects (string filter, int? maxCount, Azure.RequestContext context);
abstract member GetProjects : string * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetProjects : string * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetProjects (filter As String, maxCount As Nullable(Of Integer), context As RequestContext) As Pageable(Of BinaryData)

Parameters

filter
String

An OData filter clause to apply to the operation.

maxCount
Nullable<Int32>

The maximum number of resources to return from the operation. Example: 'top=10'.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetProjects and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

foreach (BinaryData item in client.GetProjects(null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
}

This sample shows how to call GetProjects with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DevCenterClient client = new DevCenterClient(endpoint, credential);

foreach (BinaryData item in client.GetProjects("<filter>", 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString());
}

Remarks

Below is the JSON schema for one item in the pageable response.

Response Body:

Schema for ProjectListResultValue:

{
  name: string, # Optional. Name of the project
  description: string, # Optional. Description of the project.
}

Applies to