# ObjFileSourceUnion

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Reference](https://developer.m-files.com/APIs/gRPC-API/Reference/index.md) > [Messages](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/

Union for object file source type specific data in ObjFileSource.

- **Full name:** `MFiles.ObjFileSourceUnion`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)
- **Nested types:** [`ObjFileSourceUnion.UndefinedSourceData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UndefinedSourceData), [`ObjFileSourceUnion.BlankTemplateData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-BlankTemplateData), [`ObjFileSourceUnion.UserDefinedTemplateData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UserDefinedTemplateData), [`ObjFileSourceUnion.UploadedFileData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UploadedFileData), [`ObjFileSourceUnion.UploadedFilesData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UploadedFilesData), [`ObjFileSourceUnion.EmptyFilesData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-EmptyFilesData), [`ObjFileSourceUnion.FileContentData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-FileContentData)

<a id="fields"></a>

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-blank_template"></a>`blank_template` | [`ObjFileSourceUnion.BlankTemplateData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-BlankTemplateData) (oneof data) | 1 | Blank template object file source. |
| <a id="f-user_defined_template"></a>`user_defined_template` | [`ObjFileSourceUnion.UserDefinedTemplateData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UserDefinedTemplateData) (oneof data) | 2 | User defined template object file source. |
| <a id="f-uploaded_file"></a>`uploaded_file` | [`ObjFileSourceUnion.UploadedFileData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UploadedFileData) (oneof data) | 3 | Uploaded object file source. |
| <a id="f-uploaded_files"></a>`uploaded_files` | [`ObjFileSourceUnion.UploadedFilesData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-UploadedFilesData) (oneof data) | 4 | Uploaded object file source with multiple files. |
| <a id="f-empty_files"></a>`empty_files` | [`ObjFileSourceUnion.EmptyFilesData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-EmptyFilesData) (oneof data) | 5 | Empty object file source (one or more files). Only the title and extension of each file are known; there is no upload id or size because the file contents have not been uploaded yet. This type may only be used when the object is created as a draft (the draft flag must be set); otherwise the request is rejected. |
| <a id="f-file_content"></a>`file_content` | [`ObjFileSourceUnion.FileContentData`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md#t-FileContentData) (oneof data) | 6 | Inline file content object file source. |

<a id="used-in-fields"></a>

## Used in fields

- [`ObjFileSource.data`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSource/index.md#f-data): The source data; set the member that matches `type`.

<a id="t-UndefinedSourceData"></a>

## Nested message UndefinedSourceData

Undefined object file source.

Full name: `MFiles.ObjFileSourceUnion.UndefinedSourceData`

No fields.

<a id="t-BlankTemplateData"></a>

## Nested message BlankTemplateData

Blank template object file source.

Full name: `MFiles.ObjFileSourceUnion.BlankTemplateData`

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="t-BlankTemplateData-name"></a>`name` | `string` | 1 | Blank template file name. |

<a id="t-UserDefinedTemplateData"></a>

## Nested message UserDefinedTemplateData

User defined template object file source.

Full name: `MFiles.ObjFileSourceUnion.UserDefinedTemplateData`

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="t-UserDefinedTemplateData-obj_id"></a>`obj_id` | [`ObjID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjID/index.md) | 1 | User defined template object. |

<a id="t-UploadedFileData"></a>

## Nested message UploadedFileData

Uploaded object file source.

For a single-file document, the file gets the document's title at check-in; the `title` given here
is not kept.

Full name: `MFiles.ObjFileSourceUnion.UploadedFileData`

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="t-UploadedFileData-upload_id"></a>`upload_id` | `int32` | 1 | The upload session ID from UploadTempFile, committed with UploadTempFileCommit. Zero if `file_ref` is set. An upload session can be attached to one object only. |
| <a id="t-UploadedFileData-title"></a>`title` | `string` | 2 | The file name without the extension. |
| <a id="t-UploadedFileData-extension"></a>`extension` | `string` | 3 | The file extension without the dot, for example `pdf`. |
| <a id="t-UploadedFileData-size"></a>`size` | `int64` | 4 | The size of the uploaded content in bytes. |
| <a id="t-UploadedFileData-file_ref"></a>`file_ref` | `string` | 5 | The `file_ref` of a stateless upload (FileUploadWhole or FileUploadEnd). Empty if `upload_id` is set. Exactly one of `upload_id` and `file_ref` must be set. |

<a id="t-UploadedFilesData"></a>

## Nested message UploadedFilesData

Uploaded object file source with multiple files.

Full name: `MFiles.ObjFileSourceUnion.UploadedFilesData`

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="t-UploadedFilesData-uploaded_file_array"></a>`uploaded_file_array` | repeated [`UploadedFile`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.UploadedFile/index.md) | 1 |   |

<a id="t-EmptyFilesData"></a>

## Nested message EmptyFilesData

Empty object file source (one or more files). Only the title and extension of each file are known;
there is no upload id or size because the file contents have not been uploaded yet. This type may only
be used when the object is created as a draft (the draft flag must be set); otherwise the request is
rejected.

Full name: `MFiles.ObjFileSourceUnion.EmptyFilesData`

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="t-EmptyFilesData-empty_file_array"></a>`empty_file_array` | repeated [`EmptyFile`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.EmptyFile/index.md) | 1 |   |

<a id="t-FileContentData"></a>

## Nested message FileContentData

Inline file content object file source.

Only for a single-file document (Single file, 22, true) of object type 0 (Document); otherwise the
request fails with invalid argument. The content can be at most 10 MiB. Upload larger files first
and use an uploaded file source.

Full name: `MFiles.ObjFileSourceUnion.FileContentData`

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="t-FileContentData-title"></a>`title` | `string` | 1 | The file name without the extension. Required. For a single-file document the file gets the document's title at check-in. |
| <a id="t-FileContentData-extension"></a>`extension` | `string` | 2 | The file extension without the dot, for example `txt`. |
| <a id="t-FileContentData-file_data"></a>`file_data` | `bytes` | 3 | The file content, at most 10 MiB. May be empty. |
