# toggleLibraryFile()

Toggles a concrete file's open/close state.

If the file is currently opened, then it will be closed. And vice versa -> if the file is currently closed, then it will be opened. There is also an optional param to set a concrete target state, but you may use [closeLibraryFile()](/reference/sdk/methods/closelibraryfile.md) and [openLibraryFile()](/reference/sdk/methods/openlibraryfile.md) to achieve similar functionality.

```javascript
//This will toggle the file's open/close state
sambaFrame.toggleLibraryFile('c0771004-c9fc-4308-be4f-6264d8e486af');

//This will open the file, equivalent to sambaFrame.openLibraryFile();
sambaFrame.toggleLibraryFile('c0771004-c9fc-4308-be4f-6264d8e486af', true); 

//This will close the file, equivalent to sambaFrame.closeLibraryFile();
sambaFrame.toggleLibraryFile('c0771004-c9fc-4308-be4f-6264d8e486af', false);
```

**Sample use case**: \
You may have buttons in your integration to control file opening and closing.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/sdk/methods/togglelibraryfile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
