Click or drag to resize

BackgroundCopyManagerEnumerateJobs Method (Boolean)

Enumerates the jobs in the transfer queue. The order of the jobs in the enumerator is arbitrary.

Namespace:  usis.Net.Bits
Assembly:  usis.Net.Bits (in usis.Net.Bits.dll) Version: 3.0.0.0 (3.0.0.0)
Syntax
public IEnumerable<BackgroundCopyJob> EnumerateJobs(
	bool forAllUsers
)

Parameters

forAllUsers
Type: SystemBoolean
A value that indicates whether to include all jobs in the transfer queue - those owned by the user and those owned by others. The user must be an administrator when this flag is true.

Return Value

Type: IEnumerableBackgroundCopyJob
An enumerator to iterate through the list of BackgroundCopyJob objects that represent the jobs in the queue.
Exceptions
ExceptionCondition
ObjectDisposedExceptionThe method was called after the object was disposed.
Remarks

The enumerator provides a snapshot of the jobs in the transfer queue at the time you call the EnumerateJobs method. If you retrieve property values from a job in the list, however, the values reflect the current property values of the job.

Each BackgroundCopyJob object that is returned by the enumerator holds a reference to a COM interface and implements the IDisposable intrface. Therefore you should call Dispose when your are finished with it.

Examples
C#
using System;
using usis.Net.Bits;

namespace BitsTest
{
    internal static class Sample
    {
        internal static void Main()
        {
            using (var manager = BackgroundCopyManager.Connect())
            {
                Console.WriteLine("BITS Version {0}", manager.Version);
                Console.WriteLine();

                // list all BITS jobs of the current user
                foreach (var job in manager.EnumerateJobs(false))
                {
                    Console.WriteLine("{0} '{1}' {2}", job.Id.ToString("B"), job.DisplayName, job.State.ToString());
                    job.Dispose();
                }
            }
        }
    }
}
See Also