cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Is there an existing programmatic way to find objects by owner?

gfleming
1-Newbie

Is there an existing programmatic way to find objects by owner?

In Thingworx 7.2, I would like to find all objects owned by a particular user.

I see that I can use SpotlightSearch to find all objects of a particular type and then use an InfoTable filter to filter by owner.

However, is there a more direct way to do this that woud reduce the response payload from the server to only objects owned by the specified user without post filtering?

Thanks for any feedback,

Gordon Fleming

6 REPLIES 6

Hi Gordon,

What's owner, a custom property made by you? there's no built in owner concept on TW.

Best Regards,

Carles.

Then what does EntityServices  SetOwner service do?

I don't know for what purpose it's SetOwner, but clearly it's not easily recoverable this value, as there isn't any GetOwner or alike. I've tested some candidates and neither this information it's inside:

  • GetMetadata
  • GetMetadataWithPermissionsAsJSON
  • GetSummaryInformation
  • GetThingSummaryInformation

Maybe better if you need an "owner" feature, build your own creating a property called "owner" on the things.

Actually, what I am attempting to do is delete a user.  I was thinking that I could find all the entities owned by that user and migrate them to another user but as you've stated there does not appear to be a built-in owner concept.  Although, dashboards do have an owner as GetDashboardByTitle only returned dashboards owned by the user invoking GetDashboardByTitle, so it appears at least Dashboards have an owner.

If there is no true concept of owner, then I assume to delete a user I would have to determine if any runtime, or design time permissions reference the user an update them before deleting the user?

About searching permissions for a given user, won't be easy either, you will have to crawl everything on your instance, and look at existing permissions and remove it one by one.

And yes, when you delete a user, the permission remains...

Integrity on deletion it's not the best characteristic on TW...

Best Regards,

Carles.

If you want to left integrity intact, maybe better to Disable the user instead of deleting it.

Top Tags