Get entity field name from data storage

Get entity field name from data storage

prakash.muthu
Advocate Advocate
364 Views
2 Replies
Message 1 of 3

Get entity field name from data storage

prakash.muthu
Advocate
Advocate

Hi, 

How to read entity field value without knowing field name. Is there options to list down all fields in entity.

 

FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.OfClass(typeof(DataStorage));

foreach (DataStorage dataStorage in collector)
{
    IList<Guid> list = dataStorage.GetEntitySchemaGuids();
    foreach (Guid guid in list)
    {
        Schema schema = Schema.Lookup(guid);
        Entity entity = dataStorage.GetEntity(schema);
        if (entity != null && entity.IsValid())
        {
              //read entity field

             //string field_value = entity.Get<string>(field_name);
         }

    }

0 Likes
Accepted solutions (1)
365 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni
Accepted solution

I'm not sure offhand. However, RevitLookup enables you to examine extensible storage data, so you can use that to check out what information can and cannot be accessed programmatically, and how it can be done.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

prakash.muthu
Advocate
Advocate

@jeremy_tammik Thanks. Got field list extract options from RevitLookup.

0 Likes