Skip to content

Instantly share code, notes, and snippets.

@arcanadev
Last active February 15, 2023 18:39
Show Gist options
  • Save arcanadev/f68e8bb0de96b9b0423c10da4f2cec7d to your computer and use it in GitHub Desktop.
Save arcanadev/f68e8bb0de96b9b0423c10da4f2cec7d to your computer and use it in GitHub Desktop.
Map a drive letter to a UNC path for a job #adTempus #api #version4

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment