How to create a new content?

Create content in the repository using the language of your choice

Whether you are accessing the repo from .Net or JavaScript – it takes only a few lines of code to create, load and manipulate content items! You'll have a C# and JavaScript SDK to work with, and of course you can call our REST API from any language.
var content = Content.CreateNew(parentPath, "Task", name);
content["DisplayName"] = "My first task";
content["Description"] = "Something needs to be done";

await content.SaveAsync();
var content = Content.CreateNew("Task", parent, "MyFirstTask");
content["DisplayName"] = "My first task";
content["Description"] = "Something needs to be done";

content.Save();
import { Repository, ContentTypes } from 'sn-client-js';

let repository = new Repository.SnRepository();
repository.Content.Create('Root/Path', {
	Name: 'MyFolder'
}, ContentTypes.Folder)

/** or **/

let folder = new ContentTypes.Folder({
	Name: 'MyFolder'
}, repository);
import { Content, ContentTypes } from 'sn-client-js';
import { Actions } from 'sn-redux';

const parentPath = '/workspaces/Project/budapestprojectworkspace/tasks';
store.dispatch(
    Actions.CreateContent(parentPath, ContentTypes.Folder, {
          Name: 'MyFolder'
  })
);

How to execute a query?

Use LINQ or text-based queries to retrieve content items super fast!

The Lucene search engine, one of the fastest in the industry powers our queries. A simple but smart query language helps you retrieve exactly the content you need – even from a large repository. You can assemble queries dynamically on-the-fly and load results in a fast and efficient way.
var result1 = ContentQuery.Query( 
 "+TypeIs:Task +AssignedTo:@@CurrentUser@@ -Status:Completed +Deadline:<@@CurrentDate+3days@@");

var result2 = ContentQuery.Query("+TypeIs:@0 +Index>:@1", null, typeName, 123);
var tasks = await Content.QueryAsync("+TypeIs:Task",
    select: new[] {"Id", "Name", "Path", "DisplayName", "Description"},
    settings: new QuerySettings
    {
        EnableAutofilters = FilterStatus.Disabled,
        Top = 20
    });
let fetchContent = Collection.Read('newsdemo/external', {
    select: 'DisplayName, Subtitle',
    query: 'Type:Article AND DisplayName:Africa*'
});

fetchContent
    .map(response => response.d.results)
    .subscribe({
       next: response => {
           //do something with the response
       },
       error: error => console.error('something wrong occurred: ' + error),
       complete: () => console.log('done'),
});
import { ODataApi } from 'sn-client-js';
import { Actions } from 'sn-redux';

const taskListPath = '/workspaces/Project/budapestprojectworkspace/Tasks';

let optionObj = new ODataApi.ODataParams({
      select: ['DisplayName', 'Status']
    });

store.dispatch(Actions.RequestContent(taskListPath, optionObj));
  • Want to see more APIs?

    Want to see more APIs?

    Dive deep into the extensive documentation

    Whether you need a simple API reference or detailed articles on how to customize a feature – we got you covered! Check the documentation, and in case you do not find something there, just head over to Stack Overflow, somebody is always there to help.

  • Ready to create?

    Ready to create?

    Check out 3rd party plugins and start building your own!

    Create your own features. Extensibility is one of the aspects of SenseNet that we are most proud of. Ranging from creating a simple JavaScript plugin or custom action to large modules like customizing the binary storage, you can extend the platform in many ways.

  • Want to build your own product?

    Want to build your own product?

    Join the partner program and amaze your customers!

    We are happy if you consider sensenet ECM as a base for your solution. You can build a whole product, including a fully customized user interface on top of sensenet ECM. We provide the solid platform, the only thing you have to take care of is your business workflow!

Latest Blogposts

H-1117 Budapest, Infopark sétány 1
tel: +36 1 464 70 70
fax: +36 1 464 70 80
Széchenyi2020