<?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: Open a file if central model cannot be found in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8371983#M49654</link>
    <description>&lt;P&gt;Hi Eason&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you, very much. It helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anatoly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Oct 2018 19:16:26 GMT</pubDate>
    <dc:creator>AnatolyCEL</dc:creator>
    <dc:date>2018-10-31T19:16:26Z</dc:date>
    <item>
      <title>Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8040960#M49639</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to open a file with Detach from central option via Revit API.&lt;/P&gt;&lt;P&gt;The problem is that I'm getting CentralFileCommunicationException and opening is failed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2018-06-01_1827.png" style="width: 368px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/507480iC238673764554E58/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-06-01_1827.png" alt="2018-06-01_1827.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The behavior looks strange to me. I want to open and detach, so it absolutely does not matter for me if central model available or not.&lt;/P&gt;&lt;P&gt;At the same&amp;nbsp;time, if I open this file in UI, I also get this dialog, but I can just close it and continue.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2018-06-01 18_25_08-Window.png" style="width: 383px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/507479i8B65E1CB4CED01E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-06-01 18_25_08-Window.png" alt="2018-06-01 18_25_08-Window.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there a way to open a file with Detach from central and Ignore the fact, that central model is unavailable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following code. In the OpenOptions there is no suitable property.&lt;/P&gt;&lt;PRE&gt;            // open the document
            OpenOptions options = new OpenOptions()
            {
                AllowOpeningLocalByWrongUser = true,
                Audit = false,
                DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets
            };

            Application app = sender as Application;

            // However, UIApplication can be 
            // instantiated from Application.

            UIApplication uiapp = new UIApplication(app);


            var filePath = @"d:\1.rvt";
            var modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath);
            try
            {
                uiapp.OpenAndActivateDocument(
                    modelPath, options, true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Victor.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 13:31:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8040960#M49639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-01T13:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8040981#M49640</link>
      <description>&lt;P&gt;Dear Victor,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry to hear that. I passed on your question to the development team...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&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>Fri, 01 Jun 2018 13:37:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8040981#M49640</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-06-01T13:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8059697#M49641</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error is caused by the 3rd argument of the &lt;A href="http://www.revitapidocs.com/2015/e74b17da-9e81-900e-c8df-a63718e4e82b.htm" target="_blank"&gt;OpenAndActivateDocument&lt;/A&gt; method, true means "Do Not Detach".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I test the following code snippet with Revit 2018.3 and it works as desired.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;public void CreateSaveDetachedFile(UIApplication application, string revitFilePath)
{
    //Get information of current opened revit file
    FileInfo filePath = new FileInfo(revitFilePath);
    ModelPath revitCentralFile = ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath.FullName);

    OpenOptions openOptions = new OpenOptions();
    openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets;
    openOptions.Audit = false;
    openOptions.AllowOpeningLocalByWrongUser = true;

    application.OpenAndActivateDocument(revitCentralFile, openOptions, false);
}&lt;/PRE&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 11:38:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8059697#M49641</guid>
      <dc:creator>eason.kangEDLV4</dc:creator>
      <dc:date>2018-06-11T11:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8083157#M49642</link>
      <description>&lt;P&gt;I'm experiencing the same issue in Revit 2017. If the Central file doesn't exist or is inaccessible this exception occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this exception be handled, as in my instance I'm not interested in whether the central file exists, I'm just trying to detached the local and save it as a new central file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 15:12:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8083157#M49642</guid>
      <dc:creator>kevin_fielding</dc:creator>
      <dc:date>2018-06-21T15:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8084901#M49643</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above solution is also working for Revit 2017,&amp;nbsp;please give it a try!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8059697/highlight/true#M31614" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8059697/highlight/true#M31614&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 10:11:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8084901#M49643</guid>
      <dc:creator>eason.kangEDLV4</dc:creator>
      <dc:date>2018-06-22T10:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8086517#M49644</link>
      <description>&lt;P&gt;Hi, below is the code I'm implementing. If this is run on a local file where the central file is found and accessible it runs fine, if it is not present an exception is raised.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CentralFileCommunicationException&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The file-based central model could not be reached, because e.g. the network is down or the file server is down.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Set the OpenOptions to open the RVT Detached from Central
                OpenOptions oOpenOpts = new OpenOptions();
                oOpenOpts.Audit = false;
                oOpenOpts.AllowOpeningLocalByWrongUser = true;
                oOpenOpts.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
                                
                // Set open user worksets to an empty list, so all worksets will be closed.
                oWSConfig.Open(oWSIDs);
                // Set the OpenOptions object
                oOpenOpts.SetOpenWorksetsConfiguration(oWSConfig);

                // Open the RVT
                uidetachedDoc = uiapp.OpenAndActivateDocument(oModelPath, oOpenOpts, false);
                detachedDoc = uidetachedDoc.Document;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 21:03:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8086517#M49644</guid>
      <dc:creator>kevin_fielding</dc:creator>
      <dc:date>2018-06-22T21:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8088769#M49645</link>
      <description>&lt;P&gt;The error might be related to this function call, but I didn't see it in your code snippet, it requires Network connection to the central file with my experience.&lt;/P&gt;
&lt;PRE&gt;WorksharingUtils.GetUserWorksetInfo(revitCentralFile)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to preserve worksets, you can set&amp;nbsp;WorksetConfiguration to&amp;nbsp;OpenLastViewed, it's the default option of the Revit OpenFileDialog with my finding.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DetachCentral.jpg" style="width: 665px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/515727iA8C48E1BCA39DEE9/image-dimensions/665x454?v=v2" width="665" height="454" role="button" title="DetachCentral.jpg" alt="DetachCentral.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my test code. It works as expected and the result is the same as the Revit&amp;nbsp;&lt;SPAN&gt;OpenFileDialog&amp;nbsp;does.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;public void CreateSaveDetachedFile2(UIApplication application, string revitFilePath)
{
    //Get information of current opened revit file
    FileInfo filePath = new FileInfo(revitFilePath);
    ModelPath revitCentralFile = ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath.FullName);

    var openConfig = new WorksetConfiguration(WorksetConfigurationOption.OpenLastViewed);

    OpenOptions openOptions = new OpenOptions();
    openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
    openOptions.Audit = false;
    openOptions.AllowOpeningLocalByWrongUser = true;
    openOptions.SetOpenWorksetsConfiguration(openConfig);

    application.OpenAndActivateDocument(revitCentralFile, openOptions, false);
}&lt;/PRE&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 07:46:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8088769#M49645</guid>
      <dc:creator>eason.kangEDLV4</dc:creator>
      <dc:date>2018-06-25T07:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8094235#M49646</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;this solved the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var openConfig = new WorksetConfiguration(WorksetConfigurationOption.OpenLastViewed);&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jun 2018 08:45:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8094235#M49646</guid>
      <dc:creator>e.capasso</dc:creator>
      <dc:date>2018-06-27T08:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8094434#M49647</link>
      <description>&lt;P&gt;I've tried OpenLastView and&amp;nbsp;CloseAllWorksets. Unfortunately I can't find a way of opening a local file were the central file is inaccessible without an exception being raised, below is my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ModelPath oModelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(strRVTFullPath);

                // Set the OpenOptions to open the RVT Detached from Central
                OpenOptions oOpenOpts = new OpenOptions();
                oOpenOpts.Audit = false;
                oOpenOpts.AllowOpeningLocalByWrongUser = true;
                oOpenOpts.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;

                // Set WorksetConfiguration so that all user created worksets are closed on file open.
                WorksetConfiguration oWSConfig = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
                oOpenOpts.SetOpenWorksetsConfiguration(oWSConfig);

                // Open the RVT
                try
                {
                    uidetachedDoc = uiapp.OpenAndActivateDocument(oModelPath, oOpenOpts, false);
                }
                catch (Autodesk.Revit.Exceptions.CentralFileCommunicationException)
                {
                    ????
                }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 10:16:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8094434#M49647</guid>
      <dc:creator>kevin_fielding</dc:creator>
      <dc:date>2018-06-27T10:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8094515#M49648</link>
      <description>&lt;P&gt;Using the try-catch block like you did you're assuming the exception is raised only by the OpenAndActiveDocument,&lt;/P&gt;&lt;P&gt;while it may be raised by some other function. try to use the Exception to find which function called the exception&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                ModelPath oModelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(strRVTFullPath);
                try {
                // Set the OpenOptions to open the RVT Detached from Central
                OpenOptions oOpenOpts = new OpenOptions();
                oOpenOpts.Audit = false;
                oOpenOpts.AllowOpeningLocalByWrongUser = true;
                oOpenOpts.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;

                // Set WorksetConfiguration so that all user created worksets are closed on file open.
                WorksetConfiguration oWSConfig = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
                oOpenOpts.SetOpenWorksetsConfiguration(oWSConfig);

                // Open the RVT
                uidetachedDoc = uiapp.OpenAndActivateDocument(oModelPath, oOpenOpts, false);
                }
                catch (Exception e)
                {&lt;BR /&gt;                    // The below gives you which method threw the exception
                    &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;e.TargetSite&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;                     
                }&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jun 2018 10:51:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8094515#M49648</guid>
      <dc:creator>e.capasso</dc:creator>
      <dc:date>2018-06-27T10:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8096040#M49649</link>
      <description>&lt;P&gt;Prior to posting I&amp;nbsp;debugged the code extensively, and found that the&amp;nbsp;OpenAndActivateDocument method was the cause and that the CentralFileCommunicationException was the exception raised.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was confirmed with your code suggestion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 20:35:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8096040#M49649</guid>
      <dc:creator>kevin_fielding</dc:creator>
      <dc:date>2018-06-27T20:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8096468#M49650</link>
      <description>&lt;P&gt;Could you share your whole test procedure step-by-step? I cannot reproduce the issue you're facing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the same time, could you consider providing a none-confidential reproducible test case? This need to debug.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A &lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b" target="_blank"&gt;none-confidential reproducible test case&lt;/A&gt;&amp;nbsp;is a way to describe an API problem which contains following items:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;short&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;exact description of what you are trying to achieve.&lt;/LI&gt;
&lt;LI&gt;The behavior you observe versus what you expect, and why this is a problem.&lt;/LI&gt;
&lt;LI&gt;A complete yet minimal Revit sample model to run a test in.&lt;/LI&gt;
&lt;LI&gt;A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyze its behavior live in the sample model.&lt;/LI&gt;
&lt;LI&gt;Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Note. Please remove confidential data or information from anything you want to provide to us.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your&amp;nbsp;reproducible test case cannot be posted here, please consider providing it in these ways:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;ForumPrivate Messenger:&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/help/faqpage" target="_blank"&gt;Help&lt;/A&gt; &amp;gt; Private Messenger &amp;gt; How do I send a private message?&lt;/LI&gt;
&lt;LI&gt;Revit Product Support: &lt;A href="https://knowledge.autodesk.com/contact-support/using-my-product" target="_blank"&gt;Contact product support&lt;/A&gt;, pass your&amp;nbsp;&lt;SPAN&gt;reproducible test case to him/her quoting this forum link and tell&amp;nbsp;him/her its a Revit API case, then it will be forwarded to my team.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 01:55:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8096468#M49650</guid>
      <dc:creator>eason.kangEDLV4</dc:creator>
      <dc:date>2018-06-28T01:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8360433#M49651</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the same problem. I need to open project with detach from central, but saved central model path is not exist any more. Now openAndActivate command rise exception and not open the project. How open it with API?&lt;/P&gt;&lt;P&gt;Copy SmallBuilding - R2018.rvt to c:\temp&lt;/P&gt;&lt;P&gt;Open&amp;nbsp;Project2018Macro.rvt in Revit 2018&lt;/P&gt;&lt;P&gt;Enable Macro&lt;/P&gt;&lt;P&gt;Start Macro Manager&lt;/P&gt;&lt;P&gt;Run&amp;nbsp;OpenSmallBuildingProject.Run&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anatoly.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 21:14:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8360433#M49651</guid>
      <dc:creator>AnatolyCEL</dc:creator>
      <dc:date>2018-10-25T21:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8370308#M49652</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1657455"&gt;@AnatolyCEL&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3106518"&gt;@kevin_fielding&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sorry to hear that, and thank you for your reproducible model,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1657455"&gt;@AnatolyCEL&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, I figure out how to create the detached model from worksharing based on the model you provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps I used:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open the original model in&amp;nbsp;&lt;STRONG&gt;DetachAndPreserveWorksets&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;CloseAllWorksets&lt;/STRONG&gt; mode via&amp;nbsp;the &lt;A href="http://www.revitapidocs.com/2018.1/5716f206-98ee-0490-4c6c-f0cdd6644190.htm" target="_blank"&gt;OpenDocumentFile Method (ModelPath, OpenOptions)&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Save it as new central model in your local machine and close the opened document.&lt;/LI&gt;
&lt;LI&gt;Open the new central model with the same option with the &lt;A href="http://www.revitapidocs.com/2018.1/e74b17da-9e81-900e-c8df-a63718e4e82b.htm" target="_blank"&gt;OpenAndActivateDocument Method (ModelPath, OpenOptions, Boolean)&lt;/A&gt;, then your will see Revit open it as&amp;nbsp;&lt;SPAN&gt;detached model.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Save it to somewhere you want.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And here you go, the code snippet:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;public void CreateDetachedFile(UIApplication application, string revitFilePath)
{
    //Get information of current opened revit file
    var fileInfo = new FileInfo(revitFilePath);

    // Open the original model with DetachAndPreserveWorksets option
    ModelPath revitCentralFile = ModelPathUtils.ConvertUserVisiblePathToModelPath(fileInfo.FullName);

    var openConfig = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
    var openOptions = new OpenOptions();
    openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
    openOptions.Audit = false;
    openOptions.AllowOpeningLocalByWrongUser = true;
    openOptions.SetOpenWorksetsConfiguration(openConfig);

    var openedDoc = application.Application.OpenDocumentFile(revitCentralFile, openOptions);

    var options = new SaveAsOptions();
    options.OverwriteExistingFile = true;

    var saveConfig = new WorksharingSaveAsOptions();
    saveConfig.SaveAsCentral = true;
    saveConfig.OpenWorksetsDefault = SimpleWorksetConfiguration.LastViewed;

    options.SetWorksharingOptions(saveConfig);

    var newFilename = Path.Combine(
                            fileInfo.DirectoryName,
                            string.Format(
                                "{0}_{1}{2}",
                                Path.GetFileNameWithoutExtension(fileInfo.Name),
                                "new centeral",
                                Path.GetExtension(fileInfo.Name)
                            )
    );

    var modelPathNewCtentral = ModelPathUtils.ConvertUserVisiblePathToModelPath(newFilename);

    //Save it as new central model
    openedDoc.SaveAs(modelPathNewCtentral, options);
    openedDoc.Close(true);

    // Open the model with detached from central option
    application.OpenAndActivateDocument(modelPathNewCtentral, openOptions, false);
}&lt;/PRE&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 05:49:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8370308#M49652</guid>
      <dc:creator>eason.kangEDLV4</dc:creator>
      <dc:date>2018-10-31T05:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8370678#M49653</link>
      <description>&lt;P&gt;Dear Eason,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your research and complete solution!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please put together an edited description of the solution and publish that as a blog post for future reference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can happily publish it for you on The Building Coder, if you like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&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>Wed, 31 Oct 2018 09:51:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8370678#M49653</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-10-31T09:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8371983#M49654</link>
      <description>&lt;P&gt;Hi Eason&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you, very much. It helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anatoly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:16:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8371983#M49654</guid>
      <dc:creator>AnatolyCEL</dc:creator>
      <dc:date>2018-10-31T19:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Open a file if central model cannot be found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8372675#M49655</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Jeremy,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sure, it's my pleasure! I will post a new reply here after handling some Forge backlog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1657455"&gt;@AnatolyCEL&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I'm glad it helps! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 01:55:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-file-if-central-model-cannot-be-found/m-p/8372675#M49655</guid>
      <dc:creator>eason.kangEDLV4</dc:creator>
      <dc:date>2018-11-01T01:55:29Z</dc:date>
    </item>
  </channel>
</rss>

