IDeliveryOptimizationJob::AddFileWithRanges method

Adds a file to a download job and specifies the ranges of the file you want to download.

Syntax

HRESULT AddFileWithRanges(
  [in]           LPCWSTR       fileId,
  [in]           LPCWSTR       remoteUrl,
  [in]           LPCWSTR       localName,
  [in, optional] DWORD         rangeCount,
  [in, optional] BG_FILE_RANGE ranges[],
  [in, optional] ULONG64       fileSize
);

Parameters

fileId [in]

Null terminated string that s an unique identifier of the published content. For non-published content, this can be any unique string that caller can use to identify files within a job.

remoteUrl [in]

Null-terminated string that contains the name of the file on the server.

localName [in]

Null-terminated string that contains the name of the file on the client.

rangeCount [in, optional]

Number of elements in Ranges.

ranges [in, optional]

Array of one or more BG_FILE_RANGE structures that specify the ranges to download. Do not specify duplicate or overlapping ranges.

fileSize [in, optional]

Size of the file in bytes. Pass in DO_UNKNOWN_FILE_SIZE if size is not known to the caller application.

Return value

This method returns the following return values, as well as others.

Return code Description
S_OK
Success.
E_INVALIDARG
The local file name is NULL or empty string.
E_ACCESSDENIED
User does not have permission to write to the specified directory on the client.
DO_E_INVALID_RANGE
One of the ranges is invalid. For example, InitialOffset is set to BG_LENGTH_TO_EOF.
DO_E_OVERLAPPING_RANGES
You cannot specify duplicate or overlapping ranges.
Note: The ranges are sorted by the offset of the value, not the length. If ranges are entered that have the same offset, but are in reverse order, then this error will be returned. For example, if 100.5 and 100.0 are entered in that order, then you will not be able to add the file to the job.
DO_E_INVALID_STATE
The state of the job cannot be BG_JOB_STATE_CANCELLED or BG_JOB_STATE_ACKNOWLEDGED.

Requirements

Requirement Value
Minimum supported client
Windows 10, version 1709 [desktop apps only]
Minimum supported server
Windows Server, version 1709 [desktop apps only]
Header
Deliveryoptimization.h
IDL
DeliveryOptimization.idl
Library
Dosvc.lib
DLL
Dosvc.dll
IID
IID_IDeliveryOptimizationJob is defined as EE2584CF-A69C-4848-B633-2649962B3EF7

See also

IDeliveryOptimizationJob