Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7912003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:27:42+00:00 2026-06-03T13:27:42+00:00

Using Umbraco 5.1 API, I am able to create a new content type (for

  • 0

Using Umbraco 5.1 API,
I am able to create a new content type (for creating content nodes under content tab) using the below code.

 // create content type
var typeBuilder = context.Hive.Cms().NewContentType("testType", "Test Type")
            .Define("value", "contentPicker", "Content")
            .Commit();

// create content node
var packageNode = context.Hive.Cms().NewRevision(packageNodeName, packageNodeName, "testType");
        packageNode.SetUploadedFile("value", postedFile);            
        packageNode.Publish();
        packageNode.Commit();

But is there a way to create media node using fluent API? I need to create a new custom media node with a custom type in the media tab tree.
I have tried the below approaches, but none of them seem to work

1) context.Hive.Cms().NewRevision();
2) context.Hive.Cms<IMediaStore>().NewRevision();
3) builderStep.NewRevision<Media, IMediaStore>();
4) builderStep.NewRevision<TypedEntity, IMediaStore>();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:27:44+00:00Added an answer on June 3, 2026 at 1:27 pm

    This works, but the resulting media type is not complete, as it throws an error “name should be specified” when I try to manually create a media using this type.

    CmsBuilderStep<IMediaStore> builderStep = new CmsBuilderStep<IMediaStore>(context.Hive);
    var typeBuilder = builderStep.NewMediaType<EntitySchema, IMediaStore>("testType")                   
                   .Define("package", "uploader", "General Properties")
                   .Commit();
    

    Finally I decided to create the media type manually, and use the below code to create media item via code

            // Creating a new Media item using the scorm package zip file.
            var packageNode = context.Hive.Cms<IContentStore>().NewRevision(packageNodeName, packageNodeName, "testType")
            .SetUploadedFile("package", postedFile)
    
            // set parent to media root folder - this is what makes it come under media tree
            .SetParent(FixedHiveIds.MediaVirtualRoot)
            .Publish()
            .Commit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Umbraco 5. Is it possible to create new Document Type programmatically using
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
I am developing a web application using Umbraco. I create a content called PageNotFound
I using umbraco to create a multi territory website so I have nodes set
I'm new to Umbraco. I am using Umbraco 5 RC2. I have noticed that
I am using Umbraco and came across Lucene. I found a lot of code
I am planning on using umbraco to run a huge content driven website. I
@inherits umbraco.MacroEngines.DynamicNodeContext @using System.Collections; @{ List<string> qa = new List<string>(); } //this is not
I'm new to Razor templates in Umbraco (and in general), but I prefer using
@inherits umbraco.MacroEngines.DynamicNodeContext @using System @using System.Linq @using System.Xml.Linq @{ dynamic node = new umbraco.MacroEngines.DynamicNode(1121);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.