IDocumentClient.CreateAttachmentQuery Method
Definition
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.
Overloads
CreateAttachmentQuery(Uri, SqlQuerySpec, FeedOptions) |
Method to create a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery(String, String, FeedOptions) |
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement. It returns an IQueryable{dynamic}. |
CreateAttachmentQuery(Uri, String, FeedOptions) |
Method to create a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery(Uri, FeedOptions) |
Method to create a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery(String, FeedOptions) |
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service. It returns an IOrderedQueryable{Attachment}. |
CreateAttachmentQuery(String, SqlQuerySpec, FeedOptions) |
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement with parameterized values. It returns an IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec. |
CreateAttachmentQuery<T>(String, FeedOptions) |
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery<T>(Uri, FeedOptions) |
Method to create a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery<T>(String, SqlQuerySpec, FeedOptions) |
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement with parameterized values. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec. |
CreateAttachmentQuery<T>(String, String, FeedOptions) |
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement. |
CreateAttachmentQuery<T>(Uri, SqlQuerySpec, FeedOptions) |
Method to create a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery<T>(Uri, String, FeedOptions) |
Method to create a query for attachments in the Azure Cosmos DB service. |
CreateAttachmentQuery(Uri, SqlQuerySpec, FeedOptions)
Method to create a query for attachments in the Azure Cosmos DB service.
public System.Linq.IQueryable<dynamic> CreateAttachmentQuery (Uri documentUri, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateAttachmentQuery (documentUri As Uri, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- documentUri
- Uri
The URI of the parent document.
- querySpec
- SqlQuerySpec
The sql query.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Applies to
CreateAttachmentQuery(String, String, FeedOptions)
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement. It returns an IQueryable{dynamic}.
public System.Linq.IQueryable<dynamic> CreateAttachmentQuery (string documentLink, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateAttachmentQuery (documentLink As String, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- documentLink
- String
The link to the parent document.
- sqlExpression
- String
The SQL statement.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IQueryable{dynamic} that can evaluate the query with the provided SQL statement.
Examples
foreach (Attachment attachment in client.CreateAttachmentQuery<dynamic>(
document.SelfLink,
"SELECT * FROM attachments a WHERE a.priority = 0"))
{
Console.WriteLine("Id: {0}, Priority:{1}", attachment.id, attachment.priority);
}
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
See also
Applies to
CreateAttachmentQuery(Uri, String, FeedOptions)
Method to create a query for attachments in the Azure Cosmos DB service.
public System.Linq.IQueryable<dynamic> CreateAttachmentQuery (Uri documentUri, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateAttachmentQuery (documentUri As Uri, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- documentUri
- Uri
The URI of the parent document.
- sqlExpression
- String
The sql query.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Applies to
CreateAttachmentQuery(Uri, FeedOptions)
Method to create a query for attachments in the Azure Cosmos DB service.
public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Attachment> CreateAttachmentQuery (Uri documentUri, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Attachment>
Public Function CreateAttachmentQuery (documentUri As Uri, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of Attachment)
Parameters
- documentUri
- Uri
The URI of the parent document.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Applies to
CreateAttachmentQuery(String, FeedOptions)
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service. It returns an IOrderedQueryable{Attachment}.
public System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Attachment> CreateAttachmentQuery (string documentLink, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<Microsoft.Azure.Documents.Attachment>
Public Function CreateAttachmentQuery (documentLink As String, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of Attachment)
Parameters
- documentLink
- String
The link to the parent document
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IOrderedQueryable{Attachments} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for plain text attachments using LINQ.
foreach (Attachment attachment in client.CreateAttachmentQuery(document.SelfLink).Where(a => a.ContentType == "text/plain"))
{
Console.WriteLine("Id: {0}, MediaLink:{1}", attachment.Id, attachment.MediaLink);
}
See also
Applies to
CreateAttachmentQuery(String, SqlQuerySpec, FeedOptions)
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement with parameterized values. It returns an IQueryable{dynamic}. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.
public System.Linq.IQueryable<dynamic> CreateAttachmentQuery (string documentLink, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<obj>
Public Function CreateAttachmentQuery (documentLink As String, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of Object)
Parameters
- documentLink
- String
The link to the parent document resource.
- querySpec
- SqlQuerySpec
The SqlQuerySpec instance containing the SQL expression.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IQueryable{dynamic} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for plain text attachments using a parameterized SQL query string.
var query = new SqlQuerySpec(
"SELECT * FROM attachments a WHERE a.priority = @priority",
new SqlParameterCollection(new SqlParameter[] { new SqlParameter { Name = "@priority", Value = 0 } }));
foreach (dynamic attachment in client.CreateAttachmentQuery<dynamic>(document.SelfLink, query))
{
Console.WriteLine("Id: {0}, Priority:{1}", attachment.id, attachment.priority);
}
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
See also
Applies to
CreateAttachmentQuery<T>(String, FeedOptions)
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service.
public System.Linq.IOrderedQueryable<T> CreateAttachmentQuery<T> (string documentLink, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<'T>
Public Function CreateAttachmentQuery(Of T) (documentLink As String, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of T)
Type Parameters
- T
The type of object to query.
Parameters
- documentLink
- String
The link of the parent document.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IOrderedQueryable{T} that can evaluate the query.
Examples
This example below queries against attachments of custom types.
public class PriorityAttachment : Attachment
{
[JsonProperty("priority")]
public int Priority;
}
foreach (PriorityAttachment attachment in
client.CreateAttachmentQuery<PriorityAttachment>(document.SelfLink).Where(a => a.Priority == 0))
{
Console.WriteLine("Id: {0}, MediaLink:{1}", attachment.Id, attachment.MediaLink);
}
See also
Applies to
CreateAttachmentQuery<T>(Uri, FeedOptions)
Method to create a query for attachments in the Azure Cosmos DB service.
public System.Linq.IOrderedQueryable<T> CreateAttachmentQuery<T> (Uri documentUri, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IOrderedQueryable<'T>
Public Function CreateAttachmentQuery(Of T) (documentUri As Uri, Optional feedOptions As FeedOptions = Nothing) As IOrderedQueryable(Of T)
Type Parameters
- T
The type of object to query.
Parameters
- documentUri
- Uri
The URI of the parent document.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Applies to
CreateAttachmentQuery<T>(String, SqlQuerySpec, FeedOptions)
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement with parameterized values. For more information on preparing SQL statements with parameterized values, please see SqlQuerySpec.
public System.Linq.IQueryable<T> CreateAttachmentQuery<T> (string documentLink, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : string * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<'T>
Public Function CreateAttachmentQuery(Of T) (documentLink As String, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of T)
Type Parameters
- T
Parameters
- documentLink
- String
The link of the parent document.
- querySpec
- SqlQuerySpec
The SqlQuerySpec instance containing the SQL expression.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IQueryable{T} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for plain text attachments using a parameterized SQL query string.
var query = new SqlQuerySpec(
"SELECT * FROM attachments a WHERE a.contentType = @contentType",
new SqlParameterCollection(new SqlParameter[] { new SqlParameter { Name = "@contentType", Value = "text/plain" } }));
foreach (Attachment attachment in client.CreateAttachmentQuery(document.SelfLink, query))
{
Console.WriteLine("Id: {0}, MediaLink:{1}", attachment.Id, attachment.MediaLink);
}
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
See also
Applies to
CreateAttachmentQuery<T>(String, String, FeedOptions)
Overloaded. This method creates a query for attachments in the Azure Cosmos DB service by using a SQL statement.
public System.Linq.IQueryable<T> CreateAttachmentQuery<T> (string documentLink, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : string * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<'T>
Public Function CreateAttachmentQuery(Of T) (documentLink As String, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of T)
Type Parameters
- T
Parameters
- documentLink
- String
The link of the parent document.
- sqlExpression
- String
The SQL statement.
- feedOptions
- FeedOptions
The options for processing the query result feed. For details, see FeedOptions
Returns
An IQueryable{T} that can evaluate the query with the provided SQL statement.
Examples
This example below queries for plain text attachments using a SQL query string.
foreach (Attachment attachment in client.CreateAttachmentQuery(
document.SelfLink,
"SELECT * FROM attachments a WHERE a.contentType = 'text/plain'"))
{
Console.WriteLine("Id: {0}, MediaLink:{1}", attachment.Id, attachment.MediaLink);
}
Remarks
Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started/ for syntax and examples.
See also
Applies to
CreateAttachmentQuery<T>(Uri, SqlQuerySpec, FeedOptions)
Method to create a query for attachments in the Azure Cosmos DB service.
public System.Linq.IQueryable<T> CreateAttachmentQuery<T> (Uri documentUri, Microsoft.Azure.Documents.SqlQuerySpec querySpec, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : Uri * Microsoft.Azure.Documents.SqlQuerySpec * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<'T>
Public Function CreateAttachmentQuery(Of T) (documentUri As Uri, querySpec As SqlQuerySpec, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of T)
Type Parameters
- T
Parameters
- documentUri
- Uri
The URI of the parent document.
- querySpec
- SqlQuerySpec
The sql query.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.
Applies to
CreateAttachmentQuery<T>(Uri, String, FeedOptions)
Method to create a query for attachments in the Azure Cosmos DB service.
public System.Linq.IQueryable<T> CreateAttachmentQuery<T> (Uri documentUri, string sqlExpression, Microsoft.Azure.Documents.Client.FeedOptions feedOptions = default);
abstract member CreateAttachmentQuery : Uri * string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Linq.IQueryable<'T>
Public Function CreateAttachmentQuery(Of T) (documentUri As Uri, sqlExpression As String, Optional feedOptions As FeedOptions = Nothing) As IQueryable(Of T)
Type Parameters
- T
Parameters
- documentUri
- Uri
The URI of the parent document.
- sqlExpression
- String
The sql query.
- feedOptions
- FeedOptions
(Optional) The FeedOptions for processing the query results feed.
Returns
The query result set.