You can use AutoCAD ActiveX API to manipulate the AutoCAD support path. Refer below code. As usual below code uses late binding technique while accessing ActiveX API.
[CommandMethod("AddSupportPath")]
static public void AddSupportPath()
{
object acadObject = Application.AcadApplication;
object preferences =
acadObject.GetType().InvokeMember("Preferences",
BindingFlags.GetProperty,
null, acadObject, null);
//get the files
object files =
preferences.GetType().InvokeMember("Files",
BindingFlags.GetProperty,
null, preferences, null);
//get the support path SupportPath
string supportPath =
(string)files.GetType().InvokeMember("SupportPath",
BindingFlags.GetProperty,
null, files, null);
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
if (!supportPath.Contains("C:\\BatchPublish"))
{
supportPath = supportPath + ";" + "C:\\BatchPublish";
object[] dataArry = new object[1];
dataArry[0] = supportPath;
files.GetType().InvokeMember("SupportPath",
BindingFlags.SetProperty,
null, files, dataArry);
ed.WriteMessage(supportPath + "\n");
}
else
{
ed.WriteMessage("Support path already present\n");
}
}