共用方式為


TableServiceClient class

TableServiceClient 代表 Azure 數據表服務的用戶端,可讓您對數據表和實體執行作業。

建構函式

TableServiceClient(string, NamedKeyCredential, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

TableServiceClient(string, SASCredential, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

TableServiceClient(string, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

TableServiceClient(string, TokenCredential, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

屬性

pipeline

表示向URL提出 HTTP 要求的管線。 管線可以有多個原則來管理對伺服器進行之前和之後作每個要求。

url

數據表帳戶 URL

方法

createTable(string, OperationOptions)

在指定的帳戶下建立新的數據表。

deleteTable(string, OperationOptions)

作業會永久刪除指定的數據表。

fromConnectionString(string, TableServiceClientOptions)

從連接字串建立 TableServiceClient 的實例。

getProperties(OperationOptions)

取得帳戶數據表服務的屬性,包括分析和 CORS 的屬性(跨原始來源資源分享)規則。

getStatistics(OperationOptions)

擷取與數據表服務複寫相關的統計數據。 只有在帳戶啟用讀取許可權異地備援複寫時,才能在次要位置端點上使用。

listTables(ListTableItemsOptions)

查詢指定帳戶下的數據表。

setProperties(ServiceProperties, SetPropertiesOptions)

設定帳戶數據表服務端點的屬性,包括分析和 CORS 的屬性(跨原始來源資源分享)規則。

建構函式詳細資料

TableServiceClient(string, NamedKeyCredential, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

new TableServiceClient(url: string, credential: NamedKeyCredential, options?: TableServiceClientOptions)

參數

url

string

作為所需作業目標的服務帳戶 URL,例如 「https://myaccount.table.core.windows.net"。

credential
NamedKeyCredential

NamedKeyCredential |用來驗證要求的 SASCredential。 僅支持節點

options
TableServiceClientOptions

設定 HTTP 管線的選項。

使用帳號名稱/金鑰的範例:

const { AzureNamedKeyCredential, TableServiceClient } = require("@azure/data-tables")
const account = "<storage account name>"
const sharedKeyCredential = new AzureNamedKeyCredential(account, "<account key>");

const tableServiceClient = new TableServiceClient(
  `https://${account}.table.core.windows.net`,
  sharedKeyCredential
);

TableServiceClient(string, SASCredential, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

new TableServiceClient(url: string, credential: SASCredential, options?: TableServiceClientOptions)

參數

url

string

作為所需作業目標的服務帳戶 URL,例如 「https://myaccount.table.core.windows.net"。

credential
SASCredential

用來驗證要求的 SASCredential

options
TableServiceClientOptions

設定 HTTP 管線的選項。

使用SAS令牌的範例。

const { AzureSASCredential, TableServiceClient } = require("@azure/data-tables")
const account = "<storage account name>"
const sasCredential = new AzureSASCredential(account, "<account key>");

const tableServiceClient = new TableServiceClient(
  `https://${account}.table.core.windows.net`,
  sasCredential
);

TableServiceClient(string, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

new TableServiceClient(url: string, options?: TableServiceClientOptions)

參數

url

string

作為所需作業目標的服務帳戶 URL,例如 「https://myaccount.table.core.windows.net"。 您可以附加 SAS,例如 「https://myaccount.table.core.windows.net?sasString"。

options
TableServiceClientOptions

設定 HTTP 管線的選項。 附加 SAS 令牌的範例:

const account = "<storage account name>";
const sasToken = "<SAS token>";

const tableServiceClient = new TableServiceClient(
  `https://${account}.table.core.windows.net?${sasToken}`,
);

TableServiceClient(string, TokenCredential, TableServiceClientOptions)

建立 TableServiceClient 類別的新實例。

new TableServiceClient(url: string, credential: TokenCredential, options?: TableServiceClientOptions)

參數

url

string

作為所需作業目標的服務帳戶 URL,例如 「https://myaccount.table.core.windows.net"。

credential
TokenCredential

用來驗證要求的 Azure Active Directory 認證

options
TableServiceClientOptions

設定 HTTP 管線的選項。

使用 Azure Active Directory 認證的範例:

cons { DefaultAzureCredential } = require("@azure/identity");
const { TableServiceClient } = require("@azure/data-tables")
const account = "<storage account name>"
const credential = new DefaultAzureCredential();

const tableServiceClient = new TableServiceClient(
  `https://${account}.table.core.windows.net`,
  credential
);

屬性詳細資料

pipeline

表示向URL提出 HTTP 要求的管線。 管線可以有多個原則來管理對伺服器進行之前和之後作每個要求。

pipeline: Pipeline

屬性值

url

數據表帳戶 URL

url: string

屬性值

string

方法詳細資料

createTable(string, OperationOptions)

在指定的帳戶下建立新的數據表。

function createTable(name: string, options?: OperationOptions): Promise<void>

參數

name

string

數據表的名稱。

options
OperationOptions

選項參數。

傳回

Promise<void>

deleteTable(string, OperationOptions)

作業會永久刪除指定的數據表。

function deleteTable(name: string, options?: OperationOptions): Promise<void>

參數

name

string

數據表的名稱。

options
OperationOptions

選項參數。

傳回

Promise<void>

fromConnectionString(string, TableServiceClientOptions)

從連接字串建立 TableServiceClient 的實例。

static function fromConnectionString(connectionString: string, options?: TableServiceClientOptions): TableServiceClient

參數

connectionString

string

帳戶連接字串或 Azure 記憶體帳戶的 SAS 連接字串。 [ 注意 - 帳戶連接字串只能在NODE.JS運行時間使用。 ] 帳戶連接字串範例 - DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS 連接字串範例 - BlobEndpoint=https://myaccount.table.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString

options
TableServiceClientOptions

設定 HTTP 管線的選項。

傳回

來自指定連接字串的新 TableServiceClient。

getProperties(OperationOptions)

取得帳戶數據表服務的屬性,包括分析和 CORS 的屬性(跨原始來源資源分享)規則。

function getProperties(options?: OperationOptions): Promise<GetPropertiesResponse>

參數

options
OperationOptions

選項參數。

傳回

getStatistics(OperationOptions)

擷取與數據表服務複寫相關的統計數據。 只有在帳戶啟用讀取許可權異地備援複寫時,才能在次要位置端點上使用。

function getStatistics(options?: OperationOptions): Promise<GetStatisticsResponse>

參數

options
OperationOptions

選項參數。

傳回

listTables(ListTableItemsOptions)

查詢指定帳戶下的數據表。

function listTables(options?: ListTableItemsOptions): PagedAsyncIterableIterator<TableItem, TableItemResultPage, PageSettings>

參數

options
ListTableItemsOptions

選項參數。

傳回

setProperties(ServiceProperties, SetPropertiesOptions)

設定帳戶數據表服務端點的屬性,包括分析和 CORS 的屬性(跨原始來源資源分享)規則。

function setProperties(properties: ServiceProperties, options?: SetPropertiesOptions): Promise<ServiceSetPropertiesHeaders>

參數

properties
ServiceProperties

數據表服務屬性。

options
SetPropertiesOptions

選項參數。

傳回