TreeINFO-For-M365 documentation
    Preparing search index...

    Interface ScriptApiHelpers

    interface ScriptApiHelpers {
        camlSelfTest: (listPath: string) => Promise<CamlSelfTestConsoleResult>;
        fetchListItemsByCamlQuery: FetchListItemsByCamlQuerySignature;
        getExpressionValue: (expression: string, values?: Record<string, unknown>) => unknown;
    }
    Index

    Properties

    camlSelfTest: (listPath: string) => Promise<CamlSelfTestConsoleResult>

    Runs the CAML fetch self-test against a list: loads fields, samples items, merges schema + data-driven CAML scenarios, shows a modal with live progress, and resolves with a summary when the user closes the dialog.

    Type declaration

      • (listPath: string): Promise<CamlSelfTestConsoleResult>
      • Parameters

        • listPath: string

          Server-relative list URL, path relative to the current web (e.g. Lists/MyList), or full list URL.

        Returns Promise<CamlSelfTestConsoleResult>

    const r = await tisa.helpers.camlSelfTest("Lists/MyList");
    await tisa.helpers.camlSelfTest(tisa.page.serverRelativeUrl + "/Lists/MyList");
    fetchListItemsByCamlQuery: FetchListItemsByCamlQuerySignature

    CAML list query with strategies A→D (threshold → batch by ID / DateTime columns). Same as common/caml/fetchListItemsByCamlQuery.

    const list = tisa.sp.web.getList(tisa.page.serverRelativeUrl + "/Lists/MyList");
    const r = await tisa.helpers.fetchListItemsByCamlQuery(list, viewXml, { maxQueries: 50 });
    const list = tisa.sp.web.getList(tisa.page.serverRelativeUrl + "/Lists/LargeLibrary");
    const viewXml =
    "<View Scope='RecursiveAll'>" +
    "<Query><Where><Eq><FieldRef Name='ContentType'/><Value Type='Text'>Document</Value></Eq></Where></Query>" +
    "<ViewFields><FieldRef Name='ID'/><FieldRef Name='FileLeafRef'/></ViewFields>" +
    "</View>";
    const folderUrl = tisa.page.serverRelativeUrl + "/LargeLibrary/Contracts";
    const r = await tisa.helpers.fetchListItemsByCamlQuery(
    list,
    { ViewXml: viewXml, FolderServerRelativeUrl: folderUrl },
    {
    maxItems: 500,
    maxQueries: 120,
    dateSegmentDayBase: 5,
    dateSegmentRefinementLevels: 4,
    onBatchProgress: function (info) {
    console.log("CAML batch", info.queryIndex, "items", info.itemsFoundSoFar, "progress", info.progress);
    }
    }
    );
    if (r.reason !== "completed") {
    console.warn("CAML fetch finished with reason:", r.reason, "queries:", r.queryCount, "method:", r.searchMethod);
    }
    return r.items;
    getExpressionValue: (expression: string, values?: Record<string, unknown>) => unknown

    Get expression value service is used to get the value of an expression.