Table of Contents

Class FileHttpWebRequestFactory

Namespace
Microsoft.WindowsAzure.Storage.File.Protocol
Assembly
Microsoft.WindowsAzure.Storage.dll

A factory class for constructing web requests for operations on files in the File service.

public static class FileHttpWebRequestFactory
Inheritance
FileHttpWebRequestFactory
Inherited Members

Methods

AbortCopy(Uri, int?, string, AccessCondition, bool, OperationContext)

Generates a web request to abort a copy operation.

public static HttpWebRequest AbortCopy(Uri uri, int? timeout, string copyId, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

A System.Uri specifying the absolute URI to the file.

timeout int?

An integer specifying the server timeout interval.

copyId string

The ID string of the copy operation to be aborted.

accessCondition AccessCondition

An AccessCondition object that represents the condition that must be met in order for the request to proceed. Only lease conditions are supported for this operation.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

AddMetadata(HttpWebRequest, IDictionary<string, string>)

Adds user-defined metadata to the request as one or more name-value pairs.

public static void AddMetadata(HttpWebRequest request, IDictionary<string, string> metadata)

Parameters

request HttpWebRequest

The web request.

metadata IDictionary<string, string>

The user-defined metadata.

AddMetadata(HttpWebRequest, string, string)

Adds user-defined metadata to the request as a single name-value pair.

public static void AddMetadata(HttpWebRequest request, string name, string value)

Parameters

request HttpWebRequest

The web request.

name string

The metadata name.

value string

The metadata value.

CopyFrom(Uri, int?, Uri, AccessCondition, AccessCondition, bool, OperationContext)

Generates a web request to copy from a blob or file to another file.

public static HttpWebRequest CopyFrom(Uri uri, int? timeout, Uri source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

A System.Uri specifying the absolute URI to the destination file.

timeout int?

An integer specifying the server timeout interval.

source Uri

A System.Uri specifying the absolute URI to the source object, including any necessary authentication parameters.

sourceAccessCondition AccessCondition

An AccessCondition object that represents the condition that must be met on the source object in order for the request to proceed.

destAccessCondition AccessCondition

An AccessCondition object that represents the condition that must be met on the destination file in order for the request to proceed.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

Create(Uri, int?, FileProperties, long, AccessCondition, bool, OperationContext)

Constructs a web request to create a new file.

public static HttpWebRequest Create(Uri uri, int? timeout, FileProperties properties, long fileSize, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

properties FileProperties

The properties to set for the file.

fileSize long

The size of the file.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

Delete(Uri, int?, AccessCondition, bool, OperationContext)

Constructs a web request to delete a file.

public static HttpWebRequest Delete(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

Get(Uri, int?, AccessCondition, bool, OperationContext)

Constructs a web request to get the file's content, properties, and metadata.

public static HttpWebRequest Get(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

Get(Uri, int?, DateTimeOffset?, AccessCondition, bool, OperationContext)

Constructs a web request to get the file's content, properties, and metadata.

public static HttpWebRequest Get(Uri uri, int? timeout, DateTimeOffset? shareSnapshot, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

shareSnapshot DateTimeOffset?

A DateTimeOffset specifying the share snapshot timestamp, if the share is a snapshot.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A flag indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

Get(Uri, int?, long?, long?, bool, AccessCondition, bool, OperationContext)

Constructs a web request to return a specified range of the file's content, together with its properties and metadata.

public static HttpWebRequest Get(Uri uri, int? timeout, long? offset, long? count, bool rangeContentMD5, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval, in seconds.

offset long?

The byte offset at which to begin returning content.

count long?

The number of bytes to return, or null to return all bytes through the end of the file.

rangeContentMD5 bool

If set to true, request an MD5 header for the specified range.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request to use to perform the operation.

Get(Uri, int?, long?, long?, bool, DateTimeOffset?, AccessCondition, bool, OperationContext)

Constructs a web request to return a specified range of the file's content, together with its properties and metadata.

public static HttpWebRequest Get(Uri uri, int? timeout, long? offset, long? count, bool rangeContentMD5, DateTimeOffset? shareSnapshot, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval, in seconds.

offset long?

The byte offset at which to begin returning content.

count long?

The number of bytes to return, or null to return all bytes through the end of the file.

rangeContentMD5 bool

If set to true, request an MD5 header for the specified range.

shareSnapshot DateTimeOffset?

A DateTimeOffset specifying the share snapshot timestamp, if the share is a snapshot.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A flag indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request to use to perform the operation.

GetMetadata(Uri, int?, AccessCondition, bool, OperationContext)

Constructs a web request to return the user-defined metadata for the file.

public static HttpWebRequest GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

GetMetadata(Uri, int?, DateTimeOffset?, AccessCondition, bool, OperationContext)

Constructs a web request to return the user-defined metadata for the file.

public static HttpWebRequest GetMetadata(Uri uri, int? timeout, DateTimeOffset? shareSnapshot, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

shareSnapshot DateTimeOffset?

A DateTimeOffset specifying the share snapshot timestamp, if the share is a snapshot.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A flag indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

GetProperties(Uri, int?, AccessCondition, bool, OperationContext)

Constructs a web request to return the file's system properties.

public static HttpWebRequest GetProperties(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

GetProperties(Uri, int?, DateTimeOffset?, AccessCondition, bool, OperationContext)

Constructs a web request to return the file's system properties.

public static HttpWebRequest GetProperties(Uri uri, int? timeout, DateTimeOffset? shareSnapshot, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

shareSnapshot DateTimeOffset?

A DateTimeOffset specifying the share snapshot timestamp, if the share is a snapshot.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A flag indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

GetServiceProperties(Uri, UriQueryBuilder, int?, bool, OperationContext)

Creates a web request to get the properties of the File service.

public static HttpWebRequest GetServiceProperties(Uri uri, UriQueryBuilder builder, int? timeout, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

A System.Uri specifying the File service endpoint.

builder UriQueryBuilder

A UriQueryBuilder object specifying additional parameters to add to the URI query string.

timeout int?

The server timeout interval, in seconds.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

ListRanges(Uri, int?, long?, long?, AccessCondition, bool, OperationContext)

Constructs a web request to return the list of valid ranges for a file.

public static HttpWebRequest ListRanges(Uri uri, int? timeout, long? offset, long? count, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

offset long?

The starting offset of the data range over which to list file ranges, in bytes.

count long?

The length of the data range over which to list file ranges, in bytes.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

ListRanges(Uri, int?, long?, long?, DateTimeOffset?, AccessCondition, bool, OperationContext)

Constructs a web request to return the list of valid ranges for a file.

public static HttpWebRequest ListRanges(Uri uri, int? timeout, long? offset, long? count, DateTimeOffset? shareSnapshot, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

offset long?

The starting offset of the data range over which to list file ranges, in bytes.

count long?

The length of the data range over which to list file ranges, in bytes.

shareSnapshot DateTimeOffset?

A DateTimeOffset specifying the share snapshot timestamp, if the share is a snapshot.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A flag indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request to use to perform the operation.

PutRange(Uri, int?, FileRange, FileRangeWrite, AccessCondition, bool, OperationContext)

Constructs a web request to write or clear a range of pages in a file.

public static HttpWebRequest PutRange(Uri uri, int? timeout, FileRange fileRange, FileRangeWrite fileRangeWrite, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

fileRange FileRange

The beginning and ending offsets.

fileRangeWrite FileRangeWrite

Action describing whether we are writing to a file or clearing a set of ranges.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

HttpWebRequest

A web request to use to perform the operation.

Resize(Uri, int?, long, AccessCondition, bool, OperationContext)

Constructs a web request to resize a file.

public static HttpWebRequest Resize(Uri uri, int? timeout, long newFileSize, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

newFileSize long

The new file size. Set this parameter to null to keep the existing file size.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request to use to perform the operation.

SetMetadata(Uri, int?, AccessCondition, bool, OperationContext)

Constructs a web request to set user-defined metadata for the file.

public static HttpWebRequest SetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A web request for performing the operation.

SetProperties(Uri, int?, FileProperties, AccessCondition, bool, OperationContext)

Constructs a web request to set system properties for a file.

public static HttpWebRequest SetProperties(Uri uri, int? timeout, FileProperties properties, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

The absolute URI to the file.

timeout int?

The server timeout interval.

properties FileProperties

The file's properties.

accessCondition AccessCondition

The access condition to apply to the request.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object for tracking the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

SetServiceProperties(Uri, UriQueryBuilder, int?, bool, OperationContext)

Creates a web request to set the properties of the File service.

public static HttpWebRequest SetServiceProperties(Uri uri, UriQueryBuilder builder, int? timeout, bool useVersionHeader, OperationContext operationContext)

Parameters

uri Uri

A System.Uri specifying the File service endpoint.

builder UriQueryBuilder

A UriQueryBuilder object specifying additional parameters to add to the URI query string.

timeout int?

The server timeout interval, in seconds.

useVersionHeader bool

A boolean value indicating whether to set the x-ms-version HTTP header.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

HttpWebRequest

A HttpWebRequest object.

WriteServiceProperties(FileServiceProperties, Stream)

Writes File service properties to a stream, formatted in XML.

public static void WriteServiceProperties(FileServiceProperties properties, Stream outputStream)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

outputStream Stream

The Stream object to which the formatted properties are to be written.