Global methods for Session

Global methods for session management, including user authentication, password changes, and OAuth 2.0 flows.
TIP: Global methods for Session are available under this Session alias:
Aliases
{Session}
Session
. For more information, see Session aliases.

ChangeUser

Log on to
FactoryTalk Optix Application
as a different user.
Input arguments
Argument
Data type
Description
Username
String
Specifies the username for authentication.
Password
Password
Specifies the password for authentication.
Output arguments
Argument
Data type
Description
Result
Boolean
  • True
    . Method succeeded.
  • False
    . Method failed.
ResultCode
ChangeUserResultCode
  • 0
    . Success.
  • 1
    . Wrong password.
  • 2
    . Expired password.
  • 3
    . Unable to find user.
  • 4
    . Unable to create user.
  • 6
    . Duplicate user names.

ChangePassword

Change the password of a specific
FactoryTalk Optix Application
user.
Arguments
Argument
Data type
Description
Username
String
Specifies the username for authentication.
NewPassword
Password
Defines the new password to replace the current password.
OldPassword
Password
Specifies the current password for verification before changing to the new password.
Output arguments
Argument
Data type
Description
Result
Boolean
  • True
    . Method succeeded.
  • False
    . Method failed.
ResultCode
ChangePasswordResultCode
  • 0
    . Success.
  • 1
    . Wrong password.
  • 2
    . Password already used.
  • 3
    . Password changed too recently.
  • 4
    . Password too short.
  • 5
    . Unable to find user.
  • 6
    . Unsupported operation.

Login

Log on as a specific
FactoryTalk Optix Application
user.
Input arguments
Argument
Data type
Description
Username
String
Specifies the username for authentication.
Password
Password
Defines the password for authentication.
Output arguments
Argument
Data type
Description
Result
Boolean
  • True
    . Method succeeded.
  • False
    . Method failed.
ResultCode
ChangeUserResultCode
  • 0
    . Success.
  • 1
    . Wrong password.
  • 2
    . Expired password.
  • 3
    . Unable to find user.
  • 4
    . Unable to create user.
  • 6
    . Duplicate user names.

Logout

Log out the currently logged in
FactoryTalk Optix Application
user. This method does not take or return any arguments.

StartOAuth2Flow

Start OAuth 2.0 authentication in a web browser object.
For more information about OAuth 2.0, see Authentication.
Input arguments
Argument
Data type
Description
WebBrowserNodeId
NodeId
The NodeId of the web browser object to handle OAuth 2.0 authentication. See Web browser.

StartOAuth2WebFlow

Start OAuth 2.0 authentication in a web browser external to
FactoryTalk Optix Application
. This method does not take or return any arguments.
For more information about OAuth 2.0, see Authentication.

Download file

Download a file from a
FactoryTalk Optix Application
running in a supported modern web browser. For more information about web runtime, see Web presentation engine
TIP: To include specific graphic objects or functionalities for web presentation engine only, see Profile objects for different presentation engines.
The
Download file
method is available under this alias:
Aliases
{Session}
Session
UI Session
Download file
.
Input arguments
Argument
Data type
Description
FilePath
String
Path to a file to download from the
ProjectFiles
folder.
For example,
%PROJECTDIR%\image.jpg
For more information about
ProjectFiles
and other folders, see Application structure.
FileName
String
(optional) Custom name without extension for the downloaded file. If not set, the original file name from FilePath is used.
The custom name may only contain:
  • From 1 to 255 characters.
  • Alphanumeric characters:
    A
    -
    Z
    ,
    a
    -
    z
    ,
    0
    -
    9
    , and Unicode letters.
  • Special characters:
    -
    _
    (
    )
    [
    ]
    {
    }
    +
    @
    #
    $
    &
    !
    ~
    '
  • Space and
    .
    characters: Only inside the string, but not at the start or end. The name cannot be just a single or multiple
    .
The custom name cannot use
Windows®
reserved names.
Output arguments
Argument
Data type
Description
Operation ID
Guid
Unique identifier for the download operation.
For more information about downloading files, UI Session, and the related DownloadFileStartedEvent, see File download.

Upload file

Upload a file to a
FactoryTalk Optix Application
running in a supported modern web browser. For more information about web runtime, see Web presentation engine
IMPORTANT:
File upload overwrites files with duplicate names and extensions in the target folder.
TIP: To include specific graphic objects or functionalities for web presentation engine only, see Profile objects for different presentation engines.
The
Upload file
method is available under this alias:
Aliases
{Session}
Session
UI Session
Upload file
.
Input arguments
Argument
Data type
Description
OutputPath
String
Path to the folder in the
ProjectFiles
directory where the uploaded file is saved.
For example,
%PROJECTDIR%\images
Upload is allowed only to the project files folder and its subfolders, except for the
NetSolution
and
PKI
folders.
For more information about
ProjectFiles
and other folders, see Application structure.
Output arguments
Argument
Data type
Description
Operation ID
Guid
Unique identifier for the upload operation.
For more information about uploading files, UI Session, and the related UploadFileCompletedEvent, see File upload.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal