<?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: Canceling document's check-out in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/canceling-document-s-check-out/m-p/7354800#M74695</link>
    <description>&lt;P&gt;If this is the "file is reserved" issue, here is a script you can run that will "fix it". I had tried programmatically other ways, but couldn't find anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It could be removed manually by doing a SaveCopyAs on the file, so I resorted to this workaround.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()

	Dim oTempFolder As String = System.IO.Path.GetTempPath() 'ending with \

	Dim oDoc As Document
	oDoc = ThisApplication.ActiveDocument

	If oDoc.ReservedForWrite = True
		resp = MsgBox("File is reserved for write. Remove this?", vbYesNo, "MMM iLogics")
	Else
		resp = MsgBox("File is NOT reserved for write. Save a duplicate copy over this file?", vbYesNo, "JRK iLogics")
	End If

	If resp = vbYes
		oFName = oDoc.FullFileName
		oTempFileName = oTempFolder &amp;amp; System.IO.Path.GetFileName(oFName)
		
		oDoc.SaveAs(oTempFileName, True)
		oDoc.SaveAs(oTempFolder &amp;amp; "[BACKUP]" &amp;amp; System.IO.Path.GetFileName(oFName), True)
		
		'Process.Start(oTempFolder)
		
		System.IO.File.Delete(oFName)
		System.IO.File.Move(oTempFileName, oFName)
		
		ThisApplication.FileManager.RefreshAllDocuments()
	End If
End Sub&lt;/PRE&gt;</description>
    <pubDate>Tue, 05 Sep 2017 13:52:05 GMT</pubDate>
    <dc:creator>MechMachineMan</dc:creator>
    <dc:date>2017-09-05T13:52:05Z</dc:date>
    <item>
      <title>Canceling document's check-out</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/canceling-document-s-check-out/m-p/7353729#M74689</link>
      <description>&lt;P&gt;Hi, I'm looking for a programmatic way of canceling document's check-out status.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The check-out status can be found in iProperties on "Status" tab, down in the "File status" field.&lt;/P&gt;
&lt;P&gt;In the past we've used in our company some&amp;nbsp;shared projects, so we don't overwrite our work and the status stayed written in some of the documents.&lt;/P&gt;
&lt;P&gt;Now,&amp;nbsp;here are the problems:&lt;/P&gt;
&lt;P&gt;A) When someone opens any of these documents, they won't be allowed to save any changes since the document is checked out for someone else and no-one can neither check it back nor force the check out, since it's not enabled in the single-user project.&lt;/P&gt;
&lt;P&gt;B) When I'm programmatically trying to replace the mentioned file's references (in apprentice) I'll get a generic error "parameter is not correct".&lt;/P&gt;
&lt;P&gt;I've tried all of the following and in some cases it actually would replace one or two references (due to an error, I guess, since for every reference works a different or none of the listed methods), but that is way below reliable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDoc As Inventor.ApprenticeServerDocument = ...&lt;BR /&gt;Dim Position As Integer = ...
oDoc.File.ReferencedFileDescriptors(Position).ReplaceReference("%New path%")
oDoc.ReferencedDocumentDescriptors(Position).ReferencedFileDescriptor.ReplaceReference("%New path%")
oDoc.ReferencedFileDescriptors(Position).PutLogicalFileNameUsingFull("%New path%")
oDoc.ReferencedFileDescriptors(Position).PutLogicalFileNameUsingFullSpl("%New path%")&lt;/PRE&gt;
&lt;P&gt;Thanks for any help of leads to solution.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 07:23:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/canceling-document-s-check-out/m-p/7353729#M74689</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-09-05T07:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Canceling document's check-out</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/canceling-document-s-check-out/m-p/7354800#M74695</link>
      <description>&lt;P&gt;If this is the "file is reserved" issue, here is a script you can run that will "fix it". I had tried programmatically other ways, but couldn't find anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It could be removed manually by doing a SaveCopyAs on the file, so I resorted to this workaround.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()

	Dim oTempFolder As String = System.IO.Path.GetTempPath() 'ending with \

	Dim oDoc As Document
	oDoc = ThisApplication.ActiveDocument

	If oDoc.ReservedForWrite = True
		resp = MsgBox("File is reserved for write. Remove this?", vbYesNo, "MMM iLogics")
	Else
		resp = MsgBox("File is NOT reserved for write. Save a duplicate copy over this file?", vbYesNo, "JRK iLogics")
	End If

	If resp = vbYes
		oFName = oDoc.FullFileName
		oTempFileName = oTempFolder &amp;amp; System.IO.Path.GetFileName(oFName)
		
		oDoc.SaveAs(oTempFileName, True)
		oDoc.SaveAs(oTempFolder &amp;amp; "[BACKUP]" &amp;amp; System.IO.Path.GetFileName(oFName), True)
		
		'Process.Start(oTempFolder)
		
		System.IO.File.Delete(oFName)
		System.IO.File.Move(oTempFileName, oFName)
		
		ThisApplication.FileManager.RefreshAllDocuments()
	End If
End Sub&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Sep 2017 13:52:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/canceling-document-s-check-out/m-p/7354800#M74695</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-09-05T13:52:05Z</dc:date>
    </item>
  </channel>
</rss>

