This project is read-only.

Get the Id of just created content type

Topics: Administration, Core, General
Aug 18, 2015 at 9:09 PM

I am creating a content type as
This content type may be the parent of some child content type and I am cretaing parent and child at the same time.How would I get the Id of the parent content type after I create it .

Similar to Max(Id) or Last();

Aug 19, 2015 at 10:00 AM
When you use the .Create(string contentType) overload, it returns the newly created content item. Therefore you can just do:
var contentItem = _orchardServices.ContentManager.Create(contentTypeName);
var id = contentItem.Id;