<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to implement IOpenFromCloudCallback interface? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794693#M42292</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your respond. I just figure out how to implement it by following code &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;     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();
        }
    }

&lt;/PRE&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cherry&amp;nbsp; Truong&lt;/P&gt;</description>
    <pubDate>Thu, 16 May 2019 08:23:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-16T08:23:00Z</dc:date>
    <item>
      <title>How to implement IOpenFromCloudCallback interface?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794483#M42290</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying using Revit API 2019 to detach a model from BIM360 as following code:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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"))
            {
                t.Start();
                app.OpenAndActivateDocument(modelPath, openOptions, true, IOpenFromCloudCallback);

                t.Commit();
            }&lt;/PRE&gt;
&lt;P&gt;And my problem is I don't know how to implement IopenFromCloudCallback correctly so if anyone have experience with this, please help me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much :).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cherry Truong&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 06:55:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794483#M42290</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T06:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement IOpenFromCloudCallback interface?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794559#M42291</link>
      <description>&lt;P&gt;Dear Cherry,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2018/04/whats-new-in-the-revit-2019-api.html#comment-4464470775" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2018/04/whats-new-in-the-revit-2019-api.html#comment-4464470775&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 07:30:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794559#M42291</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-05-16T07:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement IOpenFromCloudCallback interface?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794693#M42292</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your respond. I just figure out how to implement it by following code &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;     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();
        }
    }

&lt;/PRE&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cherry&amp;nbsp; Truong&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 08:23:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8794693#M42292</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-16T08:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement IOpenFromCloudCallback interface?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8800986#M42293</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;, 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&amp;nbsp;&lt;SPAN&gt;DefaultOpenFromCloudCallback class which will always use the latest for open conflict.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the introduction for this callback in Revit API 2019 what's new -&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The callback method:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Autodesk.Revit.DB.&lt;SPAN&gt;IOpenFromCloudCallback.OnOpenConflict()&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;can be passed to the document open methods to gain to handle conflict cases.&amp;nbsp; &amp;nbsp;The method is passed an OpenConflictScenario value identifying the reason for the conflict (&amp;nbsp;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).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The new class:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;DefaultOpenFromCloudCallback&lt;BR class="_mce_tagged_br" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;provides a default way to handle conflicts: it always discards the local change and gets the latest version from the cloud.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;OpenConflictScenario.OutOfDate&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN class="confluence-embedded-file-wrapper"&gt;&lt;IMG class="confluence-embedded-image" src="https://wiki.autodesk.com/download/attachments/337006631/QQ%E6%88%AA%E5%9B%BE20170608170230.png?version=1&amp;amp;modificationDate=1501706495000&amp;amp;api=v2" border="0" data-image-src="/download/attachments/337006631/QQ%E6%88%AA%E5%9B%BE20170608170230.png?version=1&amp;amp;modificationDate=1501706495000&amp;amp;api=v2" data-unresolved-comment-count="0" data-linked-resource-id="337006686" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="QQ截图20170608170230.png" data-base-url="https://wiki.autodesk.com" data-linked-resource-content-type="image/png" data-linked-resource-container-id="337006631" data-linked-resource-container-version="10" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN class="confluence-embedded-file-wrapper"&gt;OpenConflictScenario.Rollback&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN class="confluence-embedded-file-wrapper"&gt;&lt;IMG class="confluence-embedded-image" src="https://wiki.autodesk.com/download/attachments/337006631/QQ%E6%88%AA%E5%9B%BE20170608162831.png?version=1&amp;amp;modificationDate=1501706525000&amp;amp;api=v2" border="0" data-image-src="/download/attachments/337006631/QQ%E6%88%AA%E5%9B%BE20170608162831.png?version=1&amp;amp;modificationDate=1501706525000&amp;amp;api=v2" data-unresolved-comment-count="0" data-linked-resource-id="337006690" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="QQ截图20170608162831.png" data-base-url="https://wiki.autodesk.com" data-linked-resource-content-type="image/png" data-linked-resource-container-id="337006631" data-linked-resource-container-version="10" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN class="confluence-embedded-file-wrapper"&gt;OpenConflictScenario.Relinquished&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN class="confluence-embedded-file-wrapper"&gt;&lt;IMG class="confluence-embedded-image" src="https://wiki.autodesk.com/download/attachments/337006631/QQ%E6%88%AA%E5%9B%BE20170512093719.png?version=1&amp;amp;modificationDate=1501706545000&amp;amp;api=v2" border="0" data-image-src="/download/attachments/337006631/QQ%E6%88%AA%E5%9B%BE20170512093719.png?version=1&amp;amp;modificationDate=1501706545000&amp;amp;api=v2" data-unresolved-comment-count="0" data-linked-resource-id="337006692" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="QQ截图20170512093719.png" data-base-url="https://wiki.autodesk.com" data-linked-resource-content-type="image/png" data-linked-resource-container-id="337006631" data-linked-resource-container-version="10" /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 04:09:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-implement-iopenfromcloudcallback-interface/m-p/8800986#M42293</guid>
      <dc:creator>phil_xia</dc:creator>
      <dc:date>2019-05-20T04:09:11Z</dc:date>
    </item>
  </channel>
</rss>

