Partager via


IBackgroundCopyJob::AddFileSet method

Adds multiple files to a job.

Syntax

HRESULT AddFileSet(
  [in] ULONG        cFileCount,
  [in] BG_FILE_INFO *paFileSet
);

Parameters

  • cFileCount [in]
    Number of elements in paFileSet.

  • paFileSet [in]
    Array of BG_FILE_INFO structures that identify the local and remote file names of the files to transfer.

    Upload jobs are restricted to a single file. If the array contains more than one element, or the job already contains a file, the method returns BG_E_TOO_MANY_FILES.

Return value

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

Return code Description
S_OK

Files were successfully added to the job.

BG_E_TOO_MANY_FILES

Upload jobs can only contain one file; you cannot add more than one file to the job. None of the files in the array were added to the job.

BG_E_TOO_MANY_FILES_IN_JOB

The MaxFilesPerJob Group Policy setting determines how many files a job can contain. Adding the file to the job exceeds the MaxFilesPerJob limit.

E_INVALIDARG

You can receive this error for one of the following reasons:

  • The local or remote file name is not valid.
  • The remote file name uses an unsupported protocol.
  • The local file name was specified using a relative path.
E_ACCESSDENIED

User does not have permission to write to the specified directory on the client.

 

Remarks

It is more efficient to call the AddFileSet method when adding multiple files to a job than to call the IBackgroundCopyJob::AddFile method in a loop. To add a single file to a job, call the AddFile method. For more information, see Adding Files to a Job.

To add a file to a job from which DO downloads ranges of data from the file, call the IBackgroundCopyJob3::AddFileWithRanges method.

Upload jobs can contain only one file. If you add more than one file, the method returns BG_E_TOO_MANY_FILES.

For downloads, DO guarantees that the version of a file (based on file size and date, not content) that it transfers will be consistent; however, it does not guarantee that a set of files will be consistent. For example, if DO is in the middle of downloading the second of two files at the time that the files are updated on the server, DO restarts the download of the second file; however, the first file is not downloaded again.

Note that if you own the file being downloaded from the server, you should create a new URL for each new version of the file. If you use the same URL for new versions of the file, some proxy servers may serve stale data from their cache because they do not verify with the original server if the file is stale.

For uploads, DO generates an error if the local file changes while the file is transferring. The error code is BG_E_FILE_CHANGED and the context is BG_ERROR_CONTEXT_LOCAL_FILE.

DO transfers the files within a job sequentially. If an error occurs while transferring a file, the job moves to an error state and no more files within the job are processed until the error is resolved.

By default, a user can add up to 200 files to a job. This limit does not apply to administrators or service accounts. To change the default, set the MaxFilesPerJob group policies.

Requirements

Minimum supported client

Windows 10, version 1709 [desktop apps only]

Minimum supported server

Windows Server 2016 [desktop apps only]

Header

Deliveryoptimization.h

IDL

DeliveryOptimization.idl

Library

Dosvc.lib

DLL

Dosvc.dll

IID

IID_IBackgroundCopyJob is defined as 37668D37-507E-4160-9316-26306D150B12

See also

IBackgroundCopyJob

IBackgroundCopyJob::AddFile

IBackgroundCopyJob::EnumFiles

IBackgroundCopyJob::GetState

IBackgroundCopyJob::Resume

IBackgroundCopyJob3::AddFileWithRanges