NuxeoClient.Client.AddDefaultSchema C# (CSharp) Method

AddDefaultSchema() public method

Adds a default document schema to be sent in all requests.
For more details about schemas, check Nuxeo Documentation Center.
public AddDefaultSchema ( string schema ) : Client
schema string A string containing the schema's name.
return Client
        public Client AddDefaultSchema(string schema)
        {
            DefaultSchemas = DefaultSchemas ?? new List<string>();
            DefaultSchemas.Add(schema);
            if (http.DefaultRequestHeaders.Contains("X-NXDocumentProperties"))
            {
                http.DefaultRequestHeaders.Remove("X-NXDocumentProperties");
            }
            http.DefaultRequestHeaders.Add("X-NXDocumentProperties", string.Join(",", DefaultSchemas));
            return this;
        }

Usage Example

        public BusinessObjects()
        {
            client = new Client(Config.ServerUrl());
            client.AddDefaultSchema("dublincore");

            // populate
            document = (Document)client.DocumentFromPath("/").Post(new Document
            {
                Type = "Folder",
                Name = "bofolder",
                Properties = new Properties { { "dc:title", "Just a folder" } }
            }).Result;
        }
All Usage Examples Of NuxeoClient.Client::AddDefaultSchema