Map a drive letter to a UNC path for a job

Language: C#

View on GitHub to download or comment.

See the Client API Examples Introduction for additional information and prerequisites.

Samples index

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.

sample.cs
			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();

Comments

View on GitHub to comment.