# Javascript: EmbeddedFile.getRelationship Method

> PDF/A only. Gets 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:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: EmbeddedFile.getRelationship Method
- **538 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/embeddedfile/getrelationship-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/embeddedfile/getrelationship-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/embeddedfile/getrelationship-method/llms-full.txt

---

### Description

PDF/A only. Gets 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.getRelationship(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

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

### Examples

The following example demonstrates `EmbeddedFile.getRelationship` in a practical document-editing workflow. PDF/A only. Gets 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.getRelationship(
            function(result) {
                console.log("get relationship result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: EmbeddedFile.getMIMEType Method](https://docs.textcontrol.com/ds-server/reference/javascript/embeddedfile/getmimetype-method/llms-full.txt)
- **Next:** [Javascript: EmbeddedFile.setCreationDate Method](https://docs.textcontrol.com/ds-server/reference/javascript/embeddedfile/setcreationdate-method/llms-full.txt)
