// Lists the node files under a task. private IEnumerable <PSNodeFile> ListNodeFilesByTask(ListNodeFileOptions options) { // Get the single node file matching the specified name if (!string.IsNullOrEmpty(options.NodeFileName)) { WriteVerbose(string.Format(Resources.GetNodeFileByTaskByName, options.NodeFileName, options.TaskId)); JobOperations jobOperations = options.Context.BatchOMClient.JobOperations; NodeFile nodeFile = jobOperations.GetNodeFile(options.JobId, options.TaskId, options.NodeFileName, options.AdditionalBehaviors); PSNodeFile psNodeFile = new PSNodeFile(nodeFile); return(new PSNodeFile[] { psNodeFile }); } // List node files using the specified filter else { string taskId = options.Task == null ? options.TaskId : options.Task.Id; ODATADetailLevel odata = null; string verboseLogString = null; if (!string.IsNullOrEmpty(options.Filter)) { verboseLogString = string.Format(Resources.GetNodeFileByTaskByOData, taskId); odata = new ODATADetailLevel(filterClause: options.Filter); } else { verboseLogString = string.Format(Resources.GetNodeFileByTaskNoFilter, taskId); } WriteVerbose(verboseLogString); IPagedEnumerable <NodeFile> nodeFiles = null; if (options.Task != null) { nodeFiles = options.Task.omObject.ListNodeFiles(options.Recursive, odata, options.AdditionalBehaviors); } else { JobOperations jobOperations = options.Context.BatchOMClient.JobOperations; nodeFiles = jobOperations.ListNodeFiles(options.JobId, options.TaskId, options.Recursive, odata, options.AdditionalBehaviors); } Func <NodeFile, PSNodeFile> mappingFunction = f => { return(new PSNodeFile(f)); }; return(PSPagedEnumerable <PSNodeFile, NodeFile> .CreateWithMaxCount( nodeFiles, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount)))); } }