Message 1 of 9
Posting OwnedByother failure
Not applicable
01-07-2016
11:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to use the API to check out an element and, if the checkout fails, post the normal error message with the opportunity to resolve it:
Attempting to check out is simple enough:
ICollection<ElementId> checkedOutIds = WorksharingUtils.CheckoutElements(doc, new ElementId[] { eid });
bool checkedOutSuccessfully = checkedOutIds.Contains(eid);
However, when it fails it does so silently, without showing the failure box. I attempted to show the box manually:
if (!checkedOutSuccessfully)
{
using (Transaction tr = new Transaction(doc, "Posting failure message"))
{
tr.Start();
FailureMessage fm = new FailureMessage(BuiltInFailures.EditingFailures.OwnedByOther);
fm.SetFailingElement(eid);
doc.PostFailure(fm);
tr.Commit();
}
return null;
}But this gives me a box without a username and no way to resolve the issue (ie Place Request).
Is there some way I can accomplish what I am looking for?