Platform SDK: Network Management

NetScheduleJobEnum

The NetScheduleJobEnum function lists the jobs queued on a specified computer. This function requires that the schedule service be started.

Security Requirements

Only members of the Administrators local group can successfully execute the NetScheduleJobEnum function on a remote server.

NET_API_STATUS NetScheduleJobEnum(
  LPCWSTR Servername,            
  LPBYTE *PointerToBuffer,       
  DWORD PreferredMaximumLength,  
  LPDWORD EntriesRead,           
  LPDWORD TotalEntries,          
  LPDWORD ResumeHandle           
);

Parameters

Servername
[in] Pointer to a constant Unicode string specifying the name of the remote server on which the function is to execute. The string must begin with \\. If this parameter is NULL, the local computer is used.
PointerToBuffer
[out] Pointer to the buffer that receives the data. The return information is an array of AT_ENUM structures. The buffer is allocated by the system and must be freed using a single call to the NetApiBufferFree function. Note that you must free the buffer even if the function fails with ERROR_MORE_DATA.
PreferredMaximumLength
[in] Specifies a DWORD value that indicates the preferred maximum length of the returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates the amount of memory required for the data. If you specify another value in this parameter, it can restrict the number of bytes that the function returns. If the buffer size is insufficient to hold all entries, the function returns ERROR_MORE_DATA. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.
EntriesRead
[out] Pointer to a DWORD value that receives the count of elements actually enumerated.
TotalEntries
[out] Pointer to a DWORD value that receives the total number of entries that could have been enumerated from the current resume position.
ResumeHandle
[in/out] Pointer to a DWORD value that contains a resume handle which is used to continue a job enumeration. The handle should be zero on the first call and left unchanged for subsequent calls. If ResumeHandle is NULL, then no resume handle is stored.

Return Values

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a Win32 API error code. For a list of error codes, see Error Codes.

Remarks

Each entry returned contains an AT_ENUM structure. The value of the JobId member can be used when calling functions that require a job identifier parameter, such as the NetScheduleJobDel function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Unsupported.
  Header: Declared in Lmat.h; include Lm.h.
  Library: Use Netapi32.lib.

See Also

Network Management Overview, Network Management Functions, Schedule Functions, AT_ENUM, NetScheduleJobDel, NetScheduleJobGetInfo