Extensible Storage using arrays

Extensible Storage using arrays

PaulCollins7972
Advocate Advocate
826 Views
1 Reply
Message 1 of 2

Extensible Storage using arrays

PaulCollins7972
Advocate
Advocate

Hi All

 

I have managed to store an array of elementIDs using Extensible Storage, but am having trouble reading the information back.

 

To save the data I have used:

 

Dim entity As New Entity(schema)

' get the field from the schema

Dim ExcludedTitleblocks As Field = schema.GetField("ExcludedTitleblocks")

' set the value for this entity

entity.Set(Of IList(Of ElementId))(ExcludedTitleblocks, tbList)

' store the entity in the element

doc.ProjectInformation.SetEntity(entity)

 

I am trying to read the data back using this (but I get an error with the last line):

 

Dim ExcludedTitleblocks As Field = s.GetField("ExcludedTitleblocks")

Dim retrievedEntity As Entity = doc.ProjectInformation.GetEntity(s)

Dim retrievedData As IList(Of ElementId) = retrievedEntity.Get(Of IList(Of ElementId))(ExcludedTitleblocks)

 

The error is "The field belongs to a different Schema from this entity, or this Entity is invalid."

 

(I had working code when I was only storing a simple elementid field)

 

Please can anyone help with the correct syntax?

 

Thanks

 

0 Likes
Accepted solutions (1)
827 Views
1 Reply
Reply (1)
Message 2 of 2

PaulCollins7972
Advocate
Advocate
Accepted solution

Wierdly this seems to be working now, but the code hasn't changed.

 

I think that the only thing that I did was close VS and start again. Maybe I changed a field name and that persisted until I restarted VS.

 

Confused....

0 Likes