U4-7390 - Missing API Method ApplicationContext.Current.Services.MacroService.CreateMacro

Created by Murray Roke 11 Nov 2015, 20:56:07 Updated by Piotr Wegner 07 Nov 2016, 21:29:14

Duplicates: U4-6789

The convention for creating something with the service api is like so:

ApplicationContext.Current.Services.ContentService.CreateContent(...);

the macro service should be the same, like so:

ApplicationContext.Current.Services.MacroService.CreateMacro(....)

but no such method exists.

Note, that I do not see ANY way to create macros using the new API, so this should fix that too. See here for what was tried: https://our.umbraco.org/forum/developers/api-questions/72828-create-macro-programatically

Comments

Sebastiaan Janssen 17 Nov 2015, 20:24:38

Umbraco.Core.Models.Macro was made public in 7.3.0. You give the MacroService an IMacro and use the Save method to save it.


Murray Roke 17 Nov 2015, 20:40:00

The duplicate part of this issue is only incidental, the main part of this request is to create a consistent API for creation.


Piotr Wegner 07 Nov 2016, 21:29:14

@claus PR has been created: https://github.com/umbraco/Umbraco-CMS/pull/1587


Priority: Normal

Type: Feature (request)

State: Open

Assignee:

Difficulty: Easy

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.8

Due in version:

Sprint:

Story Points:

Cycle: