Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to implement IOpenFromCloudCallback interface?

Message 1 of 4
688 Views, 3 Replies

How to implement IOpenFromCloudCallback interface?

Hi everyone,


I am trying using Revit API 2019 to detach a model from BIM360 as following code: 

UIApplication app = commandData.Application; 
 string path = "BIM 360://myfile"; 
ModelPath modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(path);
            OpenOptions openOptions = new OpenOptions();
            openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets;

            using (Transaction t = new Transaction(document, "Open Cloud model"))
                app.OpenAndActivateDocument(modelPath, openOptions, true, IOpenFromCloudCallback);


And my problem is I don't know how to implement IopenFromCloudCallback correctly so if anyone have experience with this, please help me. 

Thank you so much :).


Best Regards,


Cherry Truong

Message 2 of 4
in reply to: Anonymous

Dear Cherry,


As I just said in my answer to your comment on The Building Coder, I am checking with the development team to see whether they have a sample to share:


Best regards,




Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4
in reply to: jeremytammik

Hi @jeremytammik ,


Thank you for your respond. I just figure out how to implement it by following code Smiley Very Happy

     public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
            // Get control of the current document 
            UIDocument uIDocument = commandData.Application.ActiveUIDocument;
            UIApplication app = commandData.Application; 
            // Get document control
            Document document = uIDocument.Document;

            // Get current active view
            Autodesk.Revit.DB.View currentview = document.ActiveView;

            Guid projectid = Guid.Parse("myProjectGUID");
            Guid modelid = Guid.Parse("myModelGUID");

            ModelPath modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(projectid, modelid);

             OpenOptions openOptions = new OpenOptions();
            IOpenFromCloudCallback openFromCloudCallback = new cloudinterdace();

            app.OpenAndActivateDocument(modelPath, openOptions, true, openFromCloudCallback);

            return Result.Succeeded;



    public class cloudinterdace : IOpenFromCloudCallback
        public OpenConflictResult OnOpenConflict(OpenConflictScenario scenario)
            throw new NotImplementedException();

Best Regards,


Cherry  Truong

Message 4 of 4
in reply to: Anonymous

Hi @Anonymous , I am Phil from Revit engineering team. I saw your sample and the exception thrown in the implementation of IOpenFromCloudCallback probably not a good choice. You can use the default implementation provided by DefaultOpenFromCloudCallback class which will always use the latest for open conflict.

Here is the introduction for this callback in Revit API 2019 what's new -


The callback method:

  • Autodesk.Revit.DB.IOpenFromCloudCallback.OnOpenConflict()

can be passed to the document open methods to gain to handle conflict cases.   The method is passed an OpenConflictScenario value identifying the reason for the conflict ( Rollback, Relinquished or OutOfDate) and should return an OpenConflictResult with the desired response (keep local changes, discard local changes and open the latest version or cancel).

The new class:

  • DefaultOpenFromCloudCallback

provides a default way to handle conflicts: it always discards the local change and gets the latest version from the cloud.


I list the corresponding UI for the input OpenConflictScenario for your reference and you can implement your handling logic to return KeepLocalChanges, DiscardLocalChangesAndOpenLatestVersion or just cancel the opening.


  • OpenConflictScenario.OutOfDate


  • OpenConflictScenario.Rollback


  • OpenConflictScenario.Relinquished

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups

Rail Community