# Javascript: EmbeddedFile.setRelationship Method

> PDF/A only. Sets an optional string describing the relationship of the embedded file and the containing document. This string can be a predefined value or should follow the rules for second-class names (ISO 32000-1, Annex E). Predefined values are "Source", "Data", "Alternative", "Supplement" or "Unspecified".

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: EmbeddedFile.setRelationship Method
- **575 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/embeddedfile/setrelationship-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/embeddedfile/setrelationship-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/embeddedfile/setrelationship-method/llms-full.txt

---

### Description

PDF/A only. Sets an optional string describing the relationship of the embedded file and the containing document. This string can be a predefined value or should follow the rules for second-class names (ISO 32000-1, Annex E). Predefined values are "Source", "Data", "Alternative", "Supplement" or "Unspecified".

### Syntax

```javascript
<void> EmbeddedFile.setRelationship(<string> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| value | The property value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `EmbeddedFile.setRelationship` in a practical document-editing workflow. PDF/A only. Sets an optional string describing the relationship of the embedded file and the containing document. This string can be a predefined value or should follow the rules for second-class names (ISO 32000-1, Annex E). Predefined values are "Source", "Data", "Alternative", "Supplement" or "Unspecified".

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const embeddedFiles = mainText.embeddedFiles;
    embeddedFiles.getItem(function(embeddedFile) {
        if (!embeddedFile) {
            console.warn("No embedded file is available at the current input position.");
            return;
        }
    
        embeddedFile.setRelationship(
            "Quarterly report",
            function() {
                console.log("set relationship completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: EmbeddedFile.setMIMEType Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/embeddedfile/setmimetype-method/llms-full.txt)
- **Next:** [EmbeddedFileCollection Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/embeddedfilecollection/llms-full.txt)
