# ObjFileSource

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.ObjFileSource/

Struct for object file source data in a add object with files call.

Set `type` and the member of `data` that matches it, for example
`OBJ_FILE_SOURCE_TYPE_FILE_CONTENT` with `data.file_content`. Leave the whole message unset for an
object without files. See
[AddObjectWithFiles](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/AddObjectWithFiles/index.md) for what each type
requires.

- **Full name:** `MFiles.ObjFileSource`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)

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

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-type"></a>`type` | [`ObjFileSourceType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ObjFileSourceType/index.md) | 1 | Which member of `data` is used. Must match the member that is set. Values: `OBJ_FILE_SOURCE_TYPE_UNDEFINED` (0), `OBJ_FILE_SOURCE_TYPE_BLANK_TEMPLATE` (1), `OBJ_FILE_SOURCE_TYPE_USER_DEFINED_TEMPLATE` (2), `OBJ_FILE_SOURCE_TYPE_UPLOADED_FILE` (3), `OBJ_FILE_SOURCE_TYPE_UPLOADED_FILES` (4), `OBJ_FILE_SOURCE_TYPE_EMPTY_FILES` (5), `OBJ_FILE_SOURCE_TYPE_FILE_CONTENT` (6). |
| <a id="f-data"></a>`data` | [`ObjFileSourceUnion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjFileSourceUnion/index.md) | 2 | The source data; set the member that matches `type`. |

<a id="used-by-methods"></a>

## Used by methods

- [IRPCObjectOperations.AddObjectWithFiles](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/AddObjectWithFiles/index.md): Creates a new object, optionally with its files, and optionally checks it in.
- [IRPCObjectOperations.AddObjectWithFilesWithPropertyMetadata](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/AddObjectWithFilesWithPropertyMetadata/index.md): Creates a new object with files, storing metadata about each property value (who or what set it, why, and with what confidence).

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

## Used in fields

- [`AddObjectWithFilesRequest.files`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/AddObjectWithFiles/index.md#request): Where the files of the new object come from. Unset for an object without files.
- [`AddObjectWithFilesWithPropertyMetadataRequest.files`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/AddObjectWithFilesWithPropertyMetadata/index.md#request): File source.
