# GH_DocumentServer class

Namespace: [Grasshopper.Kernel](https://developer.rhino3d.com/api/gh1/namespace/grasshopper.kernel.md) · Assembly: [Grasshopper](https://developer.rhino3d.com/api/gh1/assembly/grasshopper.md)

```cs
public sealed class GH_DocumentServer : IEnumerable<GH_Document>
```

Manages and maintains a collection of GH_Documents.

## Properties

- [DocumentCount](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/documentcount.md): Gets the number of documents stored in the global list.
- [DocumentNames](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/documentnames.md): Gets a string collection containing all the names of the documents in the global list.
- [ModifiedDocumentCount](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/modifieddocumentcount.md): Gets the total number of modified (unsaved) documents.

## Indexers

- [Document](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/item.md): Gets the document at the given index.

## Methods

- [AddDocument](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/adddocument.md): (3 overloads) Add a new document to the global list. If there already is a document with the given path, it will be made active.
- [AddNewDocument](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/addnewdocument.md): Adds a new document to the global list. If a template file has been set, this document will be based on the template.
- [Contains](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/contains.md): Gets a value indicating whether or not the given document is inside the list.
- [GetEnumerator](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/getenumerator.md)
- [GetEnumerator_Generic](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/getenumerator-generic.md)
- [IndexOf](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/indexof.md): (2 overloads) Gets the index of the given document.
- [IndexOfAutoSave](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/indexofautosave.md): Gets the document index that is associated with the specified autosave location.
- [NextAvailableDocument](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/nextavailabledocument.md): Gets the most important, non-active document.
- [PromoteDocument](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/promotedocument.md): Push a document to the top of the list, meaning it will be first in line when a new default document needs to be selected.
- [RemoveAllDocuments](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/removealldocuments.md): Remove all documents in the global list.
- [RemoveDocument](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/removedocument.md): Removes a specific document from the global list. If the document isn't registered nothing will happen. If the document is owned by an IGH_DocumentOwner, the owner will be informed of the removal.
- [SafeRemoveDocument](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/saferemovedocument.md): Remove a document correctly from the server. This method shows user-interface prompts if there is unsaved data and will also save if needed.

## Events

- [DocumentAdded](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/documentadded.md)
- [DocumentRemoved](https://developer.rhino3d.com/api/gh1/type/grasshopper.kernel.gh-documentserver/documentremoved.md)
