Member Junction
    Preparing search index...

    Function searchAcrossAccounts

    • Searches for files across multiple storage accounts in parallel.

      This is the enterprise version of search that uses the account-based credential model. Each account is searched independently, allowing multiple accounts from the same provider type to be searched (e.g., two different Dropbox accounts).

      Parameters

      Returns Promise<MultiAccountSearchResult>

      A promise that resolves to aggregated results grouped by account

      const accounts = [
      { accountEntity: researchDropbox, providerEntity: dropboxProvider },
      { accountEntity: marketingDropbox, providerEntity: dropboxProvider },
      { accountEntity: engineeringGDrive, providerEntity: gdriveProvider }
      ];

      const result = await searchAcrossAccounts(accounts, 'quarterly report', {
      maxResultsPerAccount: 25,
      fileTypes: ['pdf', 'docx'],
      contextUser: currentUser
      });

      for (const accountResult of result.accountResults) {
      if (accountResult.success) {
      console.log(`${accountResult.accountName}: ${accountResult.results.length} results`);
      }
      }