I am resurrecting this post in the hopes that someone from autodesk will respond. I am using Civil 3D 2016. I know there are workarounds. Can all of the potential options available in the API be made to work please? Or, if they will never be made to work, please remove them from the vs object browser. Maybe this is fixed in 2018?
acgis.PropertyAlterationDefinition pad = atsq.PropertyAlteration;
// layer works fine
acgis.PropertyAlteration pa = pad.AddAlteration(acgis.Constants.AlterationType.AlterationLayer);
pa.Expression = "NO-PLOT";
// color works fine
acgis.PropertyAlteration pac = pad.AddAlteration(acgis.Constants.AlterationType.AlterationColor);
pac.Expression = "ByLayer";
// lineweight does not work - this generates a MapException
acgis.PropertyAlteration paw = pad.AddAlteration(acgis.Constants.AlterationType.AlterationLineWeight);
paw.Expression = "ByLayer";
atsq.EnablePropertyAlteration(true);
The solution from -kd- is a foreach loop on the query objectidcollection. There is an easy to build example in this link.
https://forums.autodesk.com/t5/autocad-map-3d-developer/query-propertyalteration-alterationtype-line...