DataFile Object

Derived from: Base Object
Defined in namespace "adsk::core" and the header file is <Core/Dashboard/DataFile.h>

Description

A data file in a data folder.

Methods

Name Description
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
copy Copies this DataFile to the specified folder.
createMilestone Makes the version this DataFile represents a milestone.
deleteMe Deletes this DataFile. This can fail if this file is referenced by another file or is currently open.
download Performs a synchronous or asynchronous download of this DataFile. Only DataFiles that represent non-Fusion data can be downloaded. For example, this will work for TXT or XLS files but will fail for F3D files.

When using this in its synchronous mode, Fusion is frozen during the download and the call will not return until the download is complete or has failed. When using this in its asynchronous mode, calling this method will start the download process and the call return before the download is complete. The event on the provided handler will be called notifying you when the download is complete.
move Moves this DataFile to the specified folder.
promote Promotes this version to be the latest version. If this is the latest version, nothing happens.
refresh Refreshes the data associated with a DataFile object to be up to date with the associated cloud data. The DataFile returned by the API reflects the local representation of the DataFile as used by the Data Panel. This is method is only useful in very limited cases and should rarely be used. In most cases the local representation will match the actual data on the cloud. In rare occasions where Fusion was off-line while the cloud processing of DataFile is completed or the DataFile is not in the folder shown in the Data Panel. Getting a DataFileFolder contents forces an update of the local data for all of the data files it contains so they will all be up to date.

Properties

Name Description
childReferences Returns a collection of DataFiles that are the children (referenced designs) this datafile references.
configurationRowId PreviewReturns the ID of the row that defines this configuration. Use the isCongiguration property to determine if this Design is a configuration or not. If this is not a configuration, this property returns an empty string.
configurationTable PreviewIf this file is a configured design or a configuration, this property returns the associated ConfigTable object. If this is not a configured design or configuration, this property returns null.

This property is typed as core.Base because the adsk.core library does not reference the fusion library where the ConfigurationTable object is defined. At runtime, this property will return a ConfigurationTable object.
createdBy Returns the User that created this data file.
dateCreated Returns the date when this data file was created as UNIX epoch time. UNIX epoch time is the number of seconds since January 1, 1970 (midnight UTC/GMT).

In Python you can import the standard time module to work with UNIX epoch time.

In C++ you can use functions in time.h and std::chrono to work with UNIX epoch time.
dateModified Returns the date when this data file was modified. Most changes to a file result in a new version which means a new DataFile is created and will have a new creation date. There are a few changes, like rename, that modify a DataFile without creating a new version and the date of that change is returned by this property.

The date is returned as UNIX epoch time, which is the number of seconds since January 1, 1970 (midnight UTC/GMT). In Python you can import the standard time module to work with UNIX epoch time. In C++ you can use functions in time.h and std::chrono to work with UNIX epoch time.
description Gets and sets the description information associated with this item.
fileExtension Gets the file extension for this data file. The file type can be inferred from this.
hasChildReferences Gets if this datafile has children, (i.e. a Fusion Design containing referenced components).
hasOutofDateChildReferences Gets if this datafile has Children (referenced components) that are out of date (not the latest version).
hasParentReferences Gets if this datafile has parents, (i.e. this is a child being referenced in another Fusion design).
id Returns the unique ID for this DataFile. This is the same id used in the Forge Data Management API for an Item and is in the unencoded form and will look similar to this: "urn:adsk.wipprod:dm.lineage:hC6k4hndRWaeIVhIjvHu8w"
inUseBy Returns the array of users that are currently using (have open for edit) this data file.
isComplete Returns if the DataFile is fully processed. This is especially useful when a new file is being saved or uploaded. The initial call to save or upload the file returns when the process has started but processing continues on the cloud. This property will return true when all of the processing has been completed and all information related to the Datafile is now available.
isConfiguration PreviewGets if this file is a configuration of a configuration table. If this returns true, the configurationRowId can be used to get the row used to define this configuration. Also, when this is true, the design is essentially read-only and edits are either blocked from taking place or cannot be saved.
isConfiguredDesign PreviewGets if this file represents a configured design. This is a design where a configuration table is defined. Use the configurationTable property to get the associated table.
isInUse Gets if this DataFile is currently in use (opened for edit) by any other user.
isMilestone Returns if the version this Datafile represents is a milestone. Returns true if it is a milestone.
isReadOnly Gets if this file is currently read-only or not. A file can be read-only for various reasons. For example, if you are running with a "Fusion for Personal Use license" and have not designate the file to be editable or if someone else is editing the file.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
lastUpdatedBy Returns the User that last updated this data file
latestVersion Returns the latest version of the DataFile. It can return a reference to the same DataFile is this DataFile is the latest version.
latestVersionNumber Gets the latest version number for this DataFile.
milestone If the version this DataFile represents is a milestone, a Milestone object will be returned. If it's not a milestone, null is returned.
milestones Returns a collection of Milestones associated with all versions of this DataFile.
name Gets and sets the displayed name of this item.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():
parentFolder Returns the parent folder this item is contained within.
parentProject Returns the parent project that this item is in.
parentReferences Returns a collection DataFiles collection that are the parents (designs that reference) this datafile.
publicLink Returns a short URL of this data file which can be shared with others.
versionId Returns the version ID for this DataFile. This is the same id used in the Forge Data Management API for an Item and is in the unencoded form and will look similar to this: "urn:adsk.wipqa:fs.file:vf.W3syIw1lQAW-5vWObMdYnA?version=2"
versionNumber Gets the version number of this DataFile.
versions Gets the other version of this item.

Accessed From

CloudFileDialog.dataFile, CloudFileDialog.dataFiles, Data.findFileById, DataEventArgs.file, DataFile.copy, DataFile.latestVersion, DataFileFuture.dataFile, DataFiles.asArray, DataFiles.item, DataFiles.itemById, DesignDataFile.copy, DesignDataFile.latestVersion, Document.dataFile, DocumentReference.dataFile, DrawingDocument.dataFile, FusionDocument.dataFile, Milestone.version, Occurrence.configuredDataFile, PersonalUseLimits.editableFiles

Derived Classes

DesignDataFile

Version

Introduced in version January 2015