Click or drag to resize

Itemcheckout Method

Checkout physical file from the vault to the specified local directory.

Namespace:  Aras.IOM
Assembly:  IOM (in IOM.dll) Version: 14.0.20.39432
Syntax
public Item checkout(
	string dir
)

Parameters

dir
Type: SystemString
Path to the directory to which the file will be checked out. The path can be either relative to the location of the client executable or absolute.

Return Value

Type: Item
If checkout has failed the method returns an "error" item; otherwise this is returned.
Exceptions
ExceptionCondition
Exception
  • The instance doesn't represent a single item.
  • Item is not of type 'File'.
  • Item doesn't have ID set.
  • The item was never stored on server (i.e. has 'isNew' attribute set to '1').
IOExceptionFile download failed.
Remarks
There are several rules about how the method could be used: a) the method could be invoked only on client; b) it's assumed that the item is of type 'File'; c) the item must have property 'filename' set. It's possible to checkout the same file multiple times. If the same file is downloaded into the same directory more than once, latest version of the file overwrites the previous one. If checkout succeeded, the method sets property 'checkedout_path' to the full path of the checked out file (this is only the run-time setting, so no update will be done in the corresponding File's record in the Innovator database.)
If physical file of the item was checked out it doesn't mean that it will be send back to the server when the item is applied. In order to check-in physical file back to the server one should call attachPhysicalFile on the item prior to calling apply on it or its parent item.
Examples
C#
...
Item files = myItem.getItemsByXPath( "/Item[@type='File']" );
int fcount = files.getItemCount();
for( int i = 0; i < fcount; i++ )
{
  Item file = files.getItemByIndex( i );
  Item result = file.checkout( "c:\\temp" );
  if( result.isError() )
  {
    Console.WriteLine( string.Format( "Failed to checkout file '{0}'", file.getProperty( "filename" ) ) );
  }
}
...
See Also