michaelh

Easy way to copy a PIPoint ?

Discussion created by michaelh Employee on Jul 8, 2011
Latest reply on Jul 8, 2011 by MichaelvdV@Atos
I guessed the easiest way to make a copy of a tag would be to get all the Attributes from the source point and pass this to  PIPoints.Add()
PIPoint src = mySrv.PIPoints["src"];
string ptClassName = src.PointClass.Name;
PointTypeConstants ptType = src.PointType;
NamedValues srcAttributes = src.PointAttributes.GetAttributes();
mySrv.PIPoints.Add(NewName, ptClassName, ptType, srcAttributes);
( similar to Excel SMT PointBuilder ) But this approach returns

Failed to create point on server.  [-10570] Attempt to edit or set internally set point attribute(changedate)

As NamedValues does not have a Remove method (?) to remove the attributes changedate, creationdate, pointid, recno, ... ( which else cannot be copied ?) I decided to simply ask the experts for the most convenient way to create a usable Attributes collection.
Remaining PointClass independent and still not creating default values, would be a nice side effect.

Thanks for any feedback...

Outcomes