(I'm using Sitecore 8.1 Update 3 with Glass Mapper.Sc version

I'm trying to get items to be created in Sitecore through Glass Mapper. We can get content items just fine right now.

But when I try to save, I get this error:

Item does not have a Template ID or Branch ID.

I have verified that object is code has a Template Id.

This is what our property map looks like for the base item (where TempalteID resides):

  public override void Configure()
     Map(config =>
        config.Id(m => m.Id);
        config.Info(m => m.Name).InfoType(SitecoreInfoType.Name);
        config.Info(m => m.DisplayName).InfoType(SitecoreInfoType.DisplayName);
        config.Info(m => m.Path).InfoType(SitecoreInfoType.Path);
        config.Info(m => m.Url).InfoType(SitecoreInfoType.Url);
        config.Info(m => m.FullPath).InfoType(SitecoreInfoType.FullPath);
        config.Info(m => m.TemplateName).InfoType(SitecoreInfoType.TemplateName);
        config.Info(m => m.TemplateId).InfoType(SitecoreInfoType.TemplateId);
        config.Field(f => f.Sortorder).FieldName("__Sortorder");

Here's what the call to Create looks like:

        using (new SecurityDisabler())
            resultItem = _sitecoreContext.Create(parentItem, contentItem, true, false);

Any ideas why I'm getting that error?

EDIT: Here's the interface with the templateid attribute.

[SitecoreType(TemplateId = "{DAF085E8-602E-43A6-8299-038FF171349F}")]
public interface IAssetUgcImageModel : IAssetUgcMediaModel
    string Alt { get; }
  • How the contentItem creation looks like? Here is the explanation why it does not work with interfaces (if you use that) - stackoverflow.com/questions/18974495/… Dec 15, 2016 at 17:20
  • And here is the exact solution how to create items with concrete types - glass.lu/Mapper/Sc/Tutorials/Tutorial15 Dec 15, 2016 at 17:24
  • Thanks for getting back to me. I tried adding the template id to the interface, but that didn't fix it. I'll update the post with the change. Dec 15, 2016 at 18:44
  • 3
    You have to add the template id for the class which is inherited from that interface. That's the main point, you can only create item from concrete class, not from interface. Dec 15, 2016 at 18:46
  • I see what you're saying. I made some changes along those lines and am moving again. I need to set up a few other things and once I have this completely working, I'll answer this with my findings. Thanks! Dec 15, 2016 at 19:51

1 Answer 1


I was able to figure this one out, with the help of Tamás Tárnok above. The solution was to add [SitecoreType(TemplateId = "Your_Sitecore_Template_Id")] to the implemented class. More information is below.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.