API Reference

Detailed and full API reference helps you master Tekla development

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

TeklaStructuresSettingsGetAdvancedOptionPaths Method

Gets the value of an advanced option as a list of valid paths. Strings with path separator ; are split into separate paths and any blank paths (containing only white space) are ignored. Paths do not need to exist but must use valid characters and format. Note: All valid paths are returned even when invalid paths are encountered.

Namespace:  Tekla.Structures
Assembly:  Tekla.Structures (in Tekla.Structures.dll) Version: 2022.0.13611
public static bool GetAdvancedOptionPaths(
	string advancedOption,
	out List<string> paths,
	TeklaStructuresSettingsInvalidPathCallback errorHandler = null


Type: SystemString
The advanced option name.
Type: System.Collections.GenericListString
The paths.
errorHandler (Optional)
Type: Tekla.StructuresTeklaStructuresSettingsInvalidPathCallback
The optional error handler callback.

Return Value

Type: Boolean
True if the variable is read successfully and contains no invalid paths; otherwise false.
The following example gets the first existing instance of a specified file name from the firm, project or system folders.
using System;
using System.Collections.Generic;
using System.IO;
using Tekla.Structures;

public class Example
    <summary>An example GetAdvancedOptionPaths error callback which logs any advanced option path error.</summary><param name="advancedOpt">The advanced option being processed when the error occurred.</param><param name="invalidString">The invalid string if identified.</param><param name="exceptionMessage">The exception message if an exception was thrown when converting the string to a path.</param>
    public static void MyGetAdvancedOptionPathsErrorCallback(string advancedOpt, string invalidString, string exceptionMessage)
                "The advanced option path string {0} could not be read correctly. Some or all of its content(s) will be ignored.",

        if (!string.IsNullOrWhiteSpace(invalidString))
            Console.WriteLine("The invalid string is: " + invalidString);

        if (!string.IsNullOrWhiteSpace(exceptionMessage))
            Console.WriteLine("The exception message is: " + exceptionMessage);

    <summary>Tries to get the first existing instance of a specified file name from the firm, 
    project or system folders.</summary><param name="fileName">Name of the file.</param><param name="filePath">The file path of the first file found.</param><returns>True if successful; otherwise false.</returns>
    public static bool TryGetFileInFirmProjectOrSystemFolders(string fileName, out string filePath)
        filePath = null;
        var advancedOptions = new List<string> { "XS_FIRM", "XS_PROJECT", "XS_SYSTEM" };
        foreach (var advancedOption in advancedOptions)
            List<string> paths;
            if (!TeklaStructuresSettings.GetAdvancedOptionPaths(
                out paths,

            foreach (var path in paths)
                var fileToFind = Path.Combine(path, fileName);
                if (File.Exists(fileToFind))
                    filePath = fileToFind;
                    return true;

        return false;
See Also