Retrieving Workset borrower/owner value

Hi all,

There seems to be many questions on the forum relating to the creation and management of Worksets, but very little in the way of checking for current ownership of all active Worksets.

I am of course aware that this function can be easily achieved from Revit, by simply clicking the Worksets button and checking. But I am trying to make a script for the office as idiot proof as possible.

The script performs a long list of functions required when issuing a model. Including synchronising and saving a detached copy of the current file before deleting all the sheets and views.

The problem is, if someone runs the script and hasn’t checked if any Worksets are still borrowed or owned by someone else, the script will run entirely and then at the end kick up an error message saying that some elements are still owned by another user and not delete the required sheets & views. This then means the detached model has to be closed and then a new local created and the process restarted.

In order to avoid this, I was hoping to create a pre-run check of the Workset values to see if any were checked out to other users, and if they were, to cancel the rest of the script before it runs through the long list of following processes.

I have found the following article ( https://thebuildingcoder.typepad.com/blog/2015/11/worksharingutils.html ) about being able to call element Workset values using the API, but unfortunately I do not know Python so cannot implement it.

Has anyone run into this before?

Thanks in advance,
Jake

Hi @haganjake2

Use @Konrad_K_Sobon’s archi-lab package node Element.GetWorksharingTooltipInfo: