Tag Get Properties Code show to access TagProperties from CodeBehind.
The Method use it TK. TK.GetTagChildrenAsDataRow()
Return Value: DataRow[]
The key for this is implementation is the method, which gets the the children from any folder as DataRow[], with each property in a column:
DataTable table = new DataTable("Table1");
table.Columns.Add("Name", typeof(string));
table.Columns.Add("TypeName", typeof(string));
// Returns the child elements of the specified Asset.
// This method can be used to retrieve tags across different folders or domains.
DataTable dt = await TK.GetChildrenElementsAsync("AssetName");
// Retrieves all rows from the DataTable.
DataRow[] rows = dt.Rows.Cast<DataRow>().ToArray();
// Returns tags as DataRow objects.
// • Without parameters: returns all root-level tags.
// • With a tag name parameter: returns the children of the specified tag.
DataRow[] rows = TK.GetTagChildrenAsDataRow("TagName");
// just for verification
int j = rows.Length;
foreach (DataRow row in rows)
{
// In this example, we are getting only the Name and Type, all columns from UnsTas tables can be accessed using this method
string name = TK.ToText(row["Name"]);
int type = TK.ToInt(row["Type"]);
string typeName = await TK.GetElementTypeAsync(name);
table.Rows.Add(name, typeName);
}//foreach
Download example: GetTagProperties.dblsn