Skip to main content

ExecuteCommand

Description

Executes a user command or a built-in command.

This method can execute both custom commands (created via CreateCustomCommand) and built-in commands (from the BuiltinCommand enumeration).

Syntax

// Execute a new custom command with data parameter
await shellFrame.Commands.ExecuteCommand(commandId, {
someCustomData: 1234
});

Parameters

NameOptionalityTypeDescription
commandIdRequirednumberThe command id. Can be a built-in command enumerated value or custom command id.
argsOptionalanyCommand-specific arguments. Different commands expect different argument structures:

| Command | args type | Description |
|---------|-----------|-------------|
| NewObject | { TemplateInfo: { Type: number, ClassID?, Name? } } | Object type and optional template info |
| MakeCopy | { TemplateInfo?: { Type, ClassID, ObjectInfo } } | Optional template for the copy |
| CheckOut | { ObjectsInfo?: IShellItems } | Objects to check out (uses selection if not provided) |
| CheckIn | { ObjectsInfo?: IShellItems } | Objects to check in (uses selection if not provided) |
| UndoCheckOut | { ObjectsInfo?: IShellItems } | Objects to undo checkout (uses selection if not provided) |
| Delete | { ObjectsInfo?: IShellItems } | Objects to delete (uses selection if not provided) |
| DownloadFile | { ObjectsInfo?: IShellItems } | Files to download (uses selection if not provided) |
| OpenFile | { ObjectsInfo?: IShellItems, isDoubleClicked? } | File to open |
| LaunchDefaultApp | { ObjectsInfo?: IShellItems, isDoubleClicked? } | Open file in default application |
| BrowseRelatedObjects | { ObjectsInfo?: IShellItems, objectTypeId: number } | Browse related objects of type |
| ShowHistory | { ObjectsInfo?: IShellItems } | Show version history |
| RollBack | undefined | Uses selection in history view |
| Refresh | undefined | No arguments needed |
| Follow/Unfollow | undefined | Uses current selection |
| AddRelationship | { sourceObject?: IObjectVersionEx } | Source object (uses selection if not provided) |
| EditRelationship | { sourceObject?: IObjectVersionEx, targetRelatedObject: IObjectVersionEx, relationshipDirections: RelationshipDirection[], relationshipPropertyDef: number } | Edit relationship target version |
| RemoveRelationship | { sourceObject?: IObjectVersionEx, targetRelatedObject: IObjectVersionEx, relationshipDirections: RelationshipDirection[], relationshipPropertyDef: number } | Remove a relationship |

Return type

TypeDescription
Promise < void >Method does not return a value

Exceptions

ArgumentError - When commandId is null or undefined.

NotFoundError - When the command is not found or access is denied.