This fragment demonstrates how to add a mapped network drive to a job
This code creates a NetworkConnection resource to map a drive letter to a UNC path for use within the job.
Job job; | |
//code for creating the job and setting other properties is omitted | |
//create the NetworkConnection to represent the drive mapping | |
var resource = (NetworkConnection)context.CreateObject(ClassID.NetworkConnection); | |
//set the UNC path that should be mapped | |
resource.Path = @"\\server\share"; | |
//assign a drive letter. Note that you must include the ":" after the letter | |
resource.DriveLetter="Q:"; | |
//add the connection to the job's Resources | |
job.Resources.Add(resource); | |
//do whatever else you need to do | |
//save the job | |
job.Save(); |