Documents.openUsingContext Method

Parent Object: Documents
Defined in namespace "adsk::core" and the header file is <Core/Application/Documents.h>

Description

Opens a previously saved document using additional context information to control how the file is opened. This method allows opening a specific version or state of a document based on the provided context, such as a timestamp that identifies a particular point in the document's history.

Syntax

"documents_var" is a variable referencing a Documents object.
# Uses no optional arguments.
returnValue = documents_var.openUsingContext(dataFile, fileOpenContext)

# Uses optional arguments.
returnValue = documents_var.openUsingContext(dataFile, fileOpenContext, visible)
"documents_var" is a variable referencing a Documents object.

#include <Core/Application/Documents.h>

// Uses no optional arguments.
returnValue = documents_var->openUsingContext(dataFile, fileOpenContext);

// Uses optional arguments.
returnValue = documents_var->openUsingContext(dataFile, fileOpenContext, visible);

Return Value

Type Description
Document Returns the open document or null if the open failed.

Parameters

Name Type Description
dataFile DataFile The item to open.
fileOpenContext FileOpenContext The additional context information about the file to open. This is obtained by using the create method on the FileOpenContext object.
visible boolean Specifies if the document should be opened visibly or not.

This is an optional argument whose default value is True.

Samples

Name Description
File Open Sample Demonstrates how to open files using the Open API and OpenUsingContext API. The sample shows how to open a file at the tip (latest version) and how to open historical versions of a file. It uses the Open API to open files at tip and iterate through historical versions, and the OpenUsingContext API to open file using FileOpenContext .

Version

Introduced in version April 2026