> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# ファイルを送信

> 本 API を呼び出して、ファイルを送信します。

本 API を呼び出して、ファイルを送信します。

## API 呼び出し説明

API の呼び出し手順は以下のとおりです。

ステップ 1：[ファイルアップロード情報を取得](/ja/open/development/obtain-file-upload-informations) API を呼び出し、ファイルをアップロードするために必要な情報を取得します。

ステップ 2：OSS のヘッダーリクエスト署名方式でファイルをアップロードします。サンプルは以下を参照してください。

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
public void test(){
               // インターフェースの戻り情報から url を取得
                String resourceUrl = "ステップ 1 のインターフェースで取得した resourceUrls";
              // インターフェースの戻り情報から headers を取得
                Map<String, String> headers = ステップ 1 のインターフェースで取得した headers；
                URL url = new URL(resourceUrl);
                HttpURLConnection connection = (HttpURLConnection)url.openConnection();
               if (headers != null) {
                for (Map.Entry<String, String> entry : headers.entrySet()) {
                    connection.setRequestProperty(entry.getKey(), entry.getValue());
                }
            }
                connection.setDoOutput(true);
                connection.setRequestMethod("PUT");
                connection.setUseCaches(false);
                connection.setReadTimeout(10000);
                connection.setConnectTimeout(10000);
                connection.connect();
                OutputStream out = connection.getOutputStream();
                InputStream is = new FileInputStream(new File("/Users/xxxxx/Desktop/テストファイル.xls"));
                byte[] b =new byte[1024];
                int temp;
                while ((temp=is.read(b))!=-1){
                       out.write(b,0,temp);
                }
                out.flush();
                out.close();
                int responseCode = connection.getResponseCode();
                connection.disconnect();
                if (responseCode == 200) {
                    System.out.println("アップロード成功");
                 } else {
                    System.out.println("アップロード失敗");
                 }
}
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
#!/usr/bin/env python

import requests

url = '<ステップ 1 のインターフェースで取得した resourceUrl>'
headers = <ステップ 1 のインターフェースで返された headers>
result = requests.put(url, data=open('<path_to_file>', 'rb'), headers=headers)
print(result)
```

C#

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
public static string HttpRequest(string url, string filePath, Dictionary<string, string> headers) {

    FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
    BinaryReader reader = new BinaryReader(fileStream);
    reader.BaseStream.Seek(0, SeekOrigin.Begin);
    byte[] datas = reader.ReadBytes((int)reader.BaseStream.Length);
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    request.Method = "PUT";
    request.Timeout = 150000;
    foreach (var header in headers) {
        request.Headers.Add($"{header.Key}", $"{header.Value}");
    }
    Stream requestStream = null;
    string responseStr = null;
    try {
        if (datas != null) {
            request.ContentLength = datas.Length;
            requestStream = request.GetRequestStream();
            requestStream.Write(datas, 0, datas.Length);
            requestStream.Close();
        } else {
            request.ContentLength = 0;
        }
        HttpWebResponse response = request.GetResponse() as HttpWebResponse;
        responseStr = response.Headers.GetValues("x-oss-request-id")[0];
    } catch (Exception ex) {
        Console.WriteLine("error");
    } finally {
        request = null;
        requestStream = null;
    }
    return responseStr;
}
```

PHP

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
$url = $result->body->headerSignatureInfo->resourceUrls[0];
$headersSource = $result->body->headerSignatureInfo->headers;
foreach ($headersSource as $key => $value) {
$headers[] = $key . ': ' . $value;
}
// content-type を空に明示的に指定する必要があります
$headers['Content-Type'] = '';

$file = '/Users/dengxian.ldx/Desktop/test.txt';

$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_TIMEOUT => 100,
CURLOPT_CONNECTTIMEOUT => 100,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_PUT => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
));
curl_setopt($ch, CURLOPT_INFILE, fopen($file , 'rb'));
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file) );
curl_setopt($ch, CURLOPT_UPLOAD, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response .PHP_EOL;
```

Node.js

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const fs = require('fs');
const request = require('request-promise');

url = <url>;
header = <headers>;

// 注意: content-type を空に明示的に指定する必要があります
headers['content-type']='';

var options = {
  method: 'PUT',
  url: url,
  headers: headers
};

fs.createReadStream('/Users/dengxian.ldx/temp/test/a.txt').pipe(request(options)).then(body =>{
  console.log(body);
}).catch(err => {
  console.log(err);
});
```

ステップ 3：本 API を呼び出してファイルを送信し、ファイルのアップロードを完了します。

### 説明

* ストレージスペースのタイプが USER の場合、当該スペースに権限を持つユーザーはすべて操作権限を有します。その他の社員は[権限を追加](/ja/open/development/add-permissions-file) API を呼び出して権限付与を行ってください。
* ストレージスペースのタイプが APP の場合、いずれの操作も[権限を追加](/ja/open/development/add-permissions-file) API を呼び出して権限付与を行う必要があります。

## リクエスト

### 基本情報

| フィールド        | 値                                                                             |
| ------------ | ----------------------------------------------------------------------------- |
| HTTP URL     | `https://api.dingtalk.io/v2.0/storage/spaces/files/{parentDentryUuid}/commit` |
| HTTP Method  | POST                                                                          |
| サポートするアプリタイプ | appType-社内アプリ　appType-サードパーティ社内アプリ                                            |
| 権限要件         | permission-Storage.File.Write-企業ストレージファイル書き込み権限                               |

### リクエストヘッダー

| 名前                          | タイプ    | 必須 | 説明                                                                                                                                                                                                                                                                                                                                              |
| --------------------------- | ------ | -- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-acs-dingtalk-access-token | String | はい | 本 API を呼び出すためのアクセス認証情報。以下の方法で取得します：   - 社内アプリの場合、[社内アプリの accessToken を取得](/ja/open/development/obtain-the-access-token-of-an-internal-app#) API を呼び出して取得します。 - サードパーティ社内アプリの場合、[サードパーティアプリにより認可された企業の accessToken を取得](https://open.dingtalk.com/document/development/obtain-the-access-token-of-the-authorized-enterprise-1#) API を呼び出して取得します。 |

### パスパラメータ

| 名前               | タイプ    | 必須 | 説明                                                                                                                                                                                                                                                 |
| ---------------- | ------ | -- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| parentDentryUuid | String | はい | 親ノードの dentryUuid。[ファイル検索](/ja/open/development/search-for-files#) または [dentryUuid 情報を取得](/ja/open/development/api-getuuidbydentryid#) API を呼び出し、レスポンスパラメータの `dentryUuid` フィールドを取得できます。    スペースのルートディレクトリの場合は、スペースのルートディレクトリの dentryUuid を指定してください。 |

### クエリパラメータ

| 名前      | タイプ    | 必須 | 説明                                                                                    |
| ------- | ------ | -- | ------------------------------------------------------------------------------------- |
| unionId | String | はい | ユーザーの unionId。[ユーザー詳細を照会](/ja/open/development/query-user-details#) API を呼び出して取得できます。 |

### リクエストボディ

| 名前                 | タイプ     | 必須  | 説明                                                                                                                                                                           |                                      |
| ------------------ | ------- | --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| uploadKey          | String  | はい  | 追加するファイルの一意の識別子。[ファイルアップロード情報を取得](/ja/open/development/obtain-file-upload-informations#) API を呼び出して uploadKey パラメータの値を取得します。                                                 |                                      |
| name               | String  | はい  | ファイル名（拡張子付き）。命名には以下の要件があります：- 先頭および末尾にスペースを含めることはできません。含まれていた場合は自動的に削除されます。 - 特殊文字（タブ、`*`、`"`、`<`、`>`、\`                                                                     | `）を含めることはできません。 - `.\` で終わることはできません。 |
| option             | Object  | いいえ | オプションパラメータ。                                                                                                                                                                  |                                      |
| size               | Long    | いいえ | デフォルトのファイルサイズ、単位：Byte。    本フィールドが空でない場合、企業ストレージシステムは実際のファイルサイズが本フィールドと一致するかを検証します。一致しない場合はエラーが返されます。                                                                         |                                      |
| conflictStrategy   | String  | いいえ | ファイル名が重複した際の処理戦略。   - **AUTO\_RENAME**：自動的に名前を変更（デフォルト） - **OVERWRITE**：上書き - **RETURN\_DENTRY\_IF\_EXISTS**：既存のファイルを返す - **RETURN\_ERROR\_IF\_EXISTS**：ファイルがすでに存在する場合エラーを返す |                                      |
| appProperties      | Array   | いいえ | 現在のファイルのアプリ属性リスト。最大値は 3。                                                                                                                                                     |                                      |
| name               | String  | はい  | 属性名。    属性名は現在のアプリ内で一意である必要があります。異なるアプリ間で同名の属性があっても相互に影響しません。                                                                                                                |                                      |
| value              | String  | はい  | 属性値。                                                                                                                                                                         |                                      |
| visibility         | String  | はい  | 属性の可視性。   - **PUBLIC**：すべてのアプリで可視 - **PRIVATE**：現在のアプリのみ可視                                                                                                                   |                                      |
| convertToOnlineDoc | Boolean | いいえ | オンラインドキュメントに変換するかどうか。   - **false**（デフォルト）：いいえ - **true**：はい                                                                                                                 |                                      |

### リクエスト例

HTTP

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST /v2.0/storage/spaces/files/uuid/commit?unionId=union_id HTTP/1.1
Host:api.dingtalk.io
x-acs-dingtalk-access-token:xxxxx
Content-Type:application/json

{
  "uploadKey" : "upload_key",
  "name" : "dentry_name",
  "option" : {
    "size" : 512,
    "conflictStrategy" : "AUTO_RENAME",
    "appProperties" : [ {
      "name" : "property_name",
      "value" : "property_value",
      "visibility" : "PRIVATE"
    } ],
    "convertToOnlineDoc" : false
  }
}
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * Token を使用してアカウント Client を初期化
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.dingtalkstorage_2_0.Client createClient() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
        config.protocol = "https";
        config.regionId = "central";
        return new com.aliyun.dingtalkstorage_2_0.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.dingtalkstorage_2_0.Client client = Sample.createClient();
        com.aliyun.dingtalkstorage_2_0.models.CommitFileHeaders commitFileHeaders = new com.aliyun.dingtalkstorage_2_0.models.CommitFileHeaders();
        commitFileHeaders.xAcsDingtalkAccessToken = "<your access token>";
        com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOptionAppProperties optionAppProperties0 = new com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOptionAppProperties()
                .setName("property_name")
                .setValue("property_value")
                .setVisibility("PRIVATE");
        com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOption option = new com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest.CommitFileRequestOption()
                .setSize(512L)
                .setConflictStrategy("AUTO_RENAME")
                .setAppProperties(java.util.Arrays.asList(
                    optionAppProperties0
                ))
                .setConvertToOnlineDoc(false);
        com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest commitFileRequest = new com.aliyun.dingtalkstorage_2_0.models.CommitFileRequest()
                .setUnionId("union_id")
                .setUploadKey("upload_key")
                .setName("dentry_name")
                .setOption(option);
        try {
            client.commitFileWithOptions("uuid", commitFileRequest, commitFileHeaders, new com.aliyun.teautil.models.RuntimeOptions());
        } catch (TeaException err) {
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
            }

        } catch (Exception _err) {
            TeaException err = new TeaException(_err.getMessage(), _err);
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
            }

        }        
    }
}
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys

from typing import List

from alibabacloud_dingtalk.storage_2_0.client import Client as dingtalkstorage_2_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.storage_2_0 import models as dingtalkstorage__2__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient

class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client() -> dingtalkstorage_2_0Client:
        """
        Token を使用してアカウント Client を初期化
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config()
        config.protocol = 'https'
        config.region_id = 'central'
        return dingtalkstorage_2_0Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        commit_file_headers = dingtalkstorage__2__0_models.CommitFileHeaders()
        commit_file_headers.x_acs_dingtalk_access_token = '<your access token>'
        option_app_properties_0 = dingtalkstorage__2__0_models.CommitFileRequestOptionAppProperties(
            name='property_name',
            value='property_value',
            visibility='PRIVATE'
        )
        option = dingtalkstorage__2__0_models.CommitFileRequestOption(
            size=512,
            conflict_strategy='AUTO_RENAME',
            app_properties=[
                option_app_properties_0
            ],
            convert_to_online_doc=False
        )
        commit_file_request = dingtalkstorage__2__0_models.CommitFileRequest(
            union_id='union_id',
            upload_key='upload_key',
            name='dentry_name',
            option=option
        )
        try:
            client.commit_file_with_options('uuid', commit_file_request, commit_file_headers, util_models.RuntimeOptions())
        except Exception as err:
            if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
                # err には code と message 属性が含まれ、開発時の問題特定に役立ちます
                pass

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        commit_file_headers = dingtalkstorage__2__0_models.CommitFileHeaders()
        commit_file_headers.x_acs_dingtalk_access_token = '<your access token>'
        option_app_properties_0 = dingtalkstorage__2__0_models.CommitFileRequestOptionAppProperties(
            name='property_name',
            value='property_value',
            visibility='PRIVATE'
        )
        option = dingtalkstorage__2__0_models.CommitFileRequestOption(
            size=512,
            conflict_strategy='AUTO_RENAME',
            app_properties=[
                option_app_properties_0
            ],
            convert_to_online_doc=False
        )
        commit_file_request = dingtalkstorage__2__0_models.CommitFileRequest(
            union_id='union_id',
            upload_key='upload_key',
            name='dentry_name',
            option=option
        )
        try:
            await client.commit_file_with_options_async('uuid', commit_file_request, commit_file_headers, util_models.RuntimeOptions())
        except Exception as err:
            if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
                # err には code と message 属性が含まれ、開発時の問題特定に役立ちます
                pass

if __name__ == '__main__':
    Sample.main(sys.argv[1:])
```

PHP

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
<?php

// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Dingtalk;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaError;
use AlibabaCloud\Tea\Utils\Utils;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileHeaders;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileRequest\option\appProperties;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileRequest\option;
use AlibabaCloud\SDK\Dingtalk\Vstorage_2_0\Models\CommitFileRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;

class Sample {

    /**
     * Token を使用してアカウント Client を初期化
     * @return Dingtalk Client
     */
    public static function createClient(){
        $config = new Config([]);
        $config->protocol = "https";
        $config->regionId = "central";
        return new Dingtalk($config);
    }

    /**
     * @param string[] $args
     * @return void
     */
    public static function main($args){
        $client = self::createClient();
        $commitFileHeaders = new CommitFileHeaders([]);
        $commitFileHeaders->xAcsDingtalkAccessToken = "<your access token>";
        $optionAppProperties0 = new appProperties([
            "name" => "property_name",
            "value" => "property_value",
            "visibility" => "PRIVATE"
        ]);
        $option = new option([
            "size" => 512,
            "conflictStrategy" => "AUTO_RENAME",
            "appProperties" => [
                $optionAppProperties0
            ],
            "convertToOnlineDoc" => false
        ]);
        $commitFileRequest = new CommitFileRequest([
            "unionId" => "union_id",
            "uploadKey" => "upload_key",
            "name" => "dentry_name",
            "option" => $option
        ]);
        try {
            $client->commitFileWithOptions("uuid", $commitFileRequest, $commitFileHeaders, new RuntimeOptions([]));
        }
        catch (Exception $err) {
            if (!($err instanceof TeaError)) {
                $err = new TeaError([], $err->getMessage(), $err->getCode(), $err);
            }
            if (!Utils::empty_($err->code) && !Utils::empty_($err->message)) {
                // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
            }
        }
    }
}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main(array_slice($argv, 1));
```

Go

```go theme={"theme":{"light":"github-light","dark":"github-dark"}}
// This file is auto-generated, don't edit it. Thanks.
package main

import (
  "os"
  util  "github.com/alibabacloud-go/tea-utils/v2/service"
  dingtalkstorage_2_0  "github.com/alibabacloud-go/dingtalk/storage_2_0"
  openapi  "github.com/alibabacloud-go/darabonba-openapi/v2/client"
  "github.com/alibabacloud-go/tea/tea"
)

/**
 * Token を使用してアカウント Client を初期化
 * @return Client
 * @throws Exception
 */
func CreateClient () (_result *dingtalkstorage_2_0.Client, _err error) {
  config := &openapi.Config{}
  config.Protocol = tea.String("https")
  config.RegionId = tea.String("central")
  _result = &dingtalkstorage_2_0.Client{}
  _result, _err = dingtalkstorage_2_0.NewClient(config)
  return _result, _err
}

func _main (args []*string) (_err error) {
  client, _err := CreateClient()
  if _err != nil {
    return _err
  }

  commitFileHeaders := &dingtalkstorage_2_0.CommitFileHeaders{}
  commitFileHeaders.XAcsDingtalkAccessToken = tea.String("<your access token>")
  optionAppProperties0 := &dingtalkstorage_2_0.CommitFileRequestOptionAppProperties{
    Name: tea.String("property_name"),
    Value: tea.String("property_value"),
    Visibility: tea.String("PRIVATE"),
  }
  option := &dingtalkstorage_2_0.CommitFileRequestOption{
    Size: tea.Int64(512),
    ConflictStrategy: tea.String("AUTO_RENAME"),
    AppProperties: []*dingtalkstorage_2_0.CommitFileRequestOptionAppProperties{optionAppProperties0},
    ConvertToOnlineDoc: tea.Bool(false),
  }
  commitFileRequest := &dingtalkstorage_2_0.CommitFileRequest{
    UnionId: tea.String("union_id"),
    UploadKey: tea.String("upload_key"),
    Name: tea.String("dentry_name"),
    Option: option,
  }
  tryErr := func()(_e error) {
    defer func() {
      if r := tea.Recover(recover()); r != nil {
        _e = r
      }
    }()
    _, _err = client.CommitFileWithOptions(tea.String("uuid"), commitFileRequest, commitFileHeaders, &util.RuntimeOptions{})
    if _err != nil {
      return _err
    }

    return nil
  }()

  if tryErr != nil {
    var err = &tea.SDKError{}
    if _t, ok := tryErr.(*tea.SDKError); ok {
      err = _t
    } else {
      err.Message = tea.String(tryErr.Error())
    }
    if !tea.BoolValue(util.Empty(err.Code)) && !tea.BoolValue(util.Empty(err.Message)) {
      // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
    }

  }
  return _err
}

func main() {
  err := _main(tea.StringSlice(os.Args[1:]))
  if err != nil {
    panic(err)
  }
}
```

Node.js

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
// This file is auto-generated, don't edit it
import Util, * as $Util from '@alicloud/tea-util';
import dingtalkstorage_2_0, * as $dingtalkstorage_2_0 from '@alicloud/dingtalk/storage_2_0';
import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
import * as $tea from '@alicloud/tea-typescript';

export default class Client {

  /**
   * Token を使用してアカウント Client を初期化
   * @return Client
   * @throws Exception
   */
  static createClient(): dingtalkstorage_2_0 {
    let config = new $OpenApi.Config({ });
    config.protocol = "https";
    config.regionId = "central";
    return new dingtalkstorage_2_0(config);
  }

  static async main(args: string[]): Promise<void> {
    let client = Client.createClient();
    let commitFileHeaders = new $dingtalkstorage_2_0.CommitFileHeaders({ });
    commitFileHeaders.xAcsDingtalkAccessToken = "<your access token>";
    let optionAppProperties0 = new $dingtalkstorage_2_0.CommitFileRequestOptionAppProperties({
      name: "property_name",
      value: "property_value",
      visibility: "PRIVATE",
    });
    let option = new $dingtalkstorage_2_0.CommitFileRequestOption({
      size: 512,
      conflictStrategy: "AUTO_RENAME",
      appProperties: [
        optionAppProperties0
      ],
      convertToOnlineDoc: false,
    });
    let commitFileRequest = new $dingtalkstorage_2_0.CommitFileRequest({
      unionId: "union_id",
      uploadKey: "upload_key",
      name: "dentry_name",
      option: option,
    });
    try {
      await client.commitFileWithOptions("uuid", commitFileRequest, commitFileHeaders, new $Util.RuntimeOptions({ }));
    } catch (err) {
      if (!Util.empty(err.code) && !Util.empty(err.message)) {
        // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
      }

    }    
  }

}

Client.main(process.argv.slice(2));
```

C#

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
// This file is auto-generated, don't edit it. Thanks.

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

using Tea;
using Tea.Utils;

namespace AlibabaCloud.SDK.Sample
{
    public class Sample 
    {

        /**
         * Token を使用してアカウント Client を初期化
         * @return Client
         * @throws Exception
         */
        public static AlibabaCloud.SDK.Dingtalkstorage_2_0.Client CreateClient()
        {
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
            config.Protocol = "https";
            config.RegionId = "central";
            return new AlibabaCloud.SDK.Dingtalkstorage_2_0.Client(config);
        }

        public static void Main(string[] args)
        {
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Client client = CreateClient();
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileHeaders commitFileHeaders = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileHeaders();
            commitFileHeaders.XAcsDingtalkAccessToken = "<your access token>";
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption.CommitFileRequestOptionAppProperties optionAppProperties0 = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption.CommitFileRequestOptionAppProperties
            {
                Name = "property_name",
                Value = "property_value",
                Visibility = "PRIVATE",
            };
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption option = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption
            {
                Size = 512,
                ConflictStrategy = "AUTO_RENAME",
                AppProperties = new List<AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest.CommitFileRequestOption.CommitFileRequestOptionAppProperties>
                {
                    optionAppProperties0
                },
                ConvertToOnlineDoc = false,
            };
            AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest commitFileRequest = new AlibabaCloud.SDK.Dingtalkstorage_2_0.Models.CommitFileRequest
            {
                UnionId = "union_id",
                UploadKey = "upload_key",
                Name = "dentry_name",
                Option = option,
            };
            try
            {
                client.CommitFileWithOptions("uuid", commitFileRequest, commitFileHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions());
            }
            catch (TeaException err)
            {
                if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                {
                    // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
                }
            }
            catch (Exception _err)
            {
                TeaException err = new TeaException(new Dictionary<string, object>
                {
                    { "message", _err.Message }
                });
                if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                {
                    // err には code と message 属性が含まれ、開発時の問題特定に役立ちます
                }
            }
        }
    }
}
```

## レスポンス

### レスポンスボディ

| 名前            | タイプ                  | 説明                                                                                                                                                                           |
| ------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| dentry        | Object               | ファイル情報。                                                                                                                                                                      |
| id            | String               | ファイル ID。                                                                                                                                                                     |
| spaceId       | String               | 所属スペース ID。                                                                                                                                                                   |
| parentId      | String               | 親ディレクトリ ID。ルートディレクトリの場合、本パラメータは 0 になります。    空値はルートディレクトリの parentId が存在しないことを表します。                                                                                            |
| type          | String               | タイプ（ディレクトリまたはファイル）。列挙値：   - **FILE**：ファイル - **FOLDER**：フォルダー                                                                                                                 |
| name          | String               | ファイル名。                                                                                                                                                                       |
| size          | Long                 | ファイルサイズ、単位：Byte。                                                                                                                                                             |
| path          | String               | スペース内でのファイルのパス。                                                                                                                                                              |
| version       | Long                 | バージョン。                                                                                                                                                                       |
| status        | String               | ステータス：   - **NORMAL**：正常 - **DELETED**：ゴミ箱 - **EXPIRED**：期限切れ                                                                                                                |
| extension     | String               | ファイル拡張子。                                                                                                                                                                     |
| creatorId     | String               | 作成者の unionId。                                                                                                                                                                |
| modifierId    | String               | 編集者の unionId。                                                                                                                                                                |
| createTime    | String               | 作成時間、iso8601 形式。例：2022-07-29T14:55Z。                                                                                                                                         |
| modifiedTime  | String               | 編集時間、iso8601 形式。例：2022-07-29T14:55Z。                                                                                                                                         |
| properties    | Object               | ファイル属性。                                                                                                                                                                      |
| readOnly      | Boolean              | ファイルが閲覧のみかどうか。   - **true**：はい - **false**：いいえ                                                                                                                               |
| appProperties | `Map<String, Array>` | 特定アプリ上の属性。key は所属スペースの ownerId、value は属性リストです。                                                                                                                               |
|               | Array                | 属性リスト。                                                                                                                                                                       |
| name          | String               | 属性名。                                                                                                                                                                         |
| value         | String               | 属性値。                                                                                                                                                                         |
| visibility    | String               | 属性の可視性。   - **PUBLIC**：すべてのアプリで可視 - **PRIVATE**：現在のアプリのみ可視                                                                                                                   |
| uuid          | String               | 一意の識別子 uuid。ファイルを移動しても本フィールドは変わりません。                                                                                                                                         |
| partitionType | String               | ストレージパーティション：   - **PUBLIC\_OSS\_PARTITION**：パブリッククラウド OSS ストレージパーティション - **MINI\_OSS\_PARTITION**：専用 MiniOSS ストレージパーティション                                                   |
| storageDriver | String               | ドライバータイプ。列挙値：   - **DINGTALK**：DingTalk 統一ストレージドライバー - **ALIDOC**：DingTalkドキュメントストレージドライバー - **SHANJI**：閃記ストレージドライバー - **UNKNOWN**：未知のドライバー                                  |
| thumbnail     | Object               | サムネイル情報。                                                                                                                                                                     |
| width         | Integer              | サムネイルの幅。                                                                                                                                                                     |
| height        | Integer              | サムネイルの高さ。                                                                                                                                                                    |
| url           | String               | サムネイル URL。                                                                                                                                                                   |
| category      | String               | カテゴリー。列挙値：   - **IMAGE**：画像 - **VIDEO**：動画 - **AUDIO**：オーディオ - **ARCHIVE**：圧縮ファイル - **SHORTCUT**：ショートカット - **DOCUMENT**：ドキュメント - **ALI\_DOC**：DingTalkドキュメント - **OTHER**：その他 |

### レスポンスボディ例

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
HTTP/1.1 200 OK
Content-Type:application/json

{
  "dentry" : {
    "id" : "dentry_id",
    "spaceId" : "space_id",
    "parentId" : "parent_id",
    "type" : "FILE",
    "name" : "dentry_name",
    "size" : 512,
    "path" : "dentry_path",
    "version" : 1,
    "status" : "NORMAL",
    "extension" : "txt",
    "creatorId" : "creator_id",
    "modifierId" : "modifier_id",
    "createTime" : "2022-01-01T10:00:00Z",
    "modifiedTime" : "2022-01-01T10:00:00Z",
    "properties" : {
      "readOnly" : true
    },
    "appProperties" : [ {
      "name" : "property_name",
      "value" : "property_value",
      "visibility" : "PRIVATE"
    } ],
    "uuid" : "uuid",
    "partitionType" : "PUBLIC_OSS_PARTITION",
    "storageDriver" : "DINGTALK",
    "thumbnail" : {
      "width" : 64,
      "height" : 64,
      "url" : "url"
    },
    "category" : "DOCUMENT"
  }
}
```

### エラーコード

本 API の呼び出しでエラーが発生した場合、エラーメッセージをもとに[グローバルエラーコード](/ja/open/development/server-api-error-codes-1)ドキュメントで解決方法を検索してください。

| HttpCode | エラーコード                      | エラーメッセージ      | 説明                         |
| -------- | --------------------------- | ------------- | -------------------------- |
| 400      | operationConcurrentControl  | %s            | 並行制御                       |
| 400      | paramError                  | %s            | パラメータエラー                   |
| 400      | paramError.parentDentryUuid | %s            | パラメータエラー-parentDentryUuid  |
| 400      | paramError.uploadKey        | %s            | パラメータエラー-uploadKey         |
| 400      | paramError.name             | %s            | パラメータエラー-name              |
| 400      | paramError.conflictStrategy | %s            | パラメータエラー-conflictStrategy  |
| 400      | spaceQuotaInsufficient      | %s            | スペース容量不足                   |
| 400      | sceneQuotaInsufficient      | %s            | シーン容量不足                    |
| 400      | appQuotaInsufficient        | %s            | アプリ容量不足                    |
| 400      | orgQuotaInsufficient        | %s            | 企業容量不足                     |
| 400      | dentryNameIllegal           | %s            | ファイル名が不正                   |
| 400      | dentryStoreError            | %s            | ファイルストレージエラー               |
| 400      | dentryNameConflict          | %s            | ファイル名が重複                   |
| 400      | dentryFormatNotSupport      | %s            | サポートされないファイル形式             |
| 403      | permissionDenied            | %s            | ユーザーにファイルをアップロードする権限がありません |
| 404      | spaceNotExist               | %s            | スペースが存在しません                |
| 500      | systemError                 | %s            | システムエラー                    |
| 500      | unknownError                | Unknown Error | 不明なエラー                     |
| 503      | operationTimeout            | %s            | リクエストタイムアウト                |
