var contentService = Services.ContentService;
var product = contentService.CreateContent(
name, // the name of the product
1000, // the parent id should be the id of the group node
"product", // the alias of the product Document Type
0
);
Which arguments do I need to pass in CreateContent method for media creation?
Dennis, thanks for your help.
Do you know which one of MediaService's methods I can use for adding existing media to Umbraco? I need to move all of the contents from one Umbraco instance to another.
How to create media content using ContentService?
I have following code:
Which arguments do I need to pass in CreateContent method for media creation?
Thanks.
Hi Denis,
Have you seen the media service, where you will find a create method. https://our.umbraco.org/documentation/reference/management/services/mediaservice
We also have a Umbraco TV chapter about the Media API. https://umbraco.tv/videos/umbraco-v7/developer/fundamentals/media-api/introduction/
Hope this helps,
/Dennis
Dennis, thanks for your help. Do you know which one of MediaService's methods I can use for adding existing media to Umbraco? I need to move all of the contents from one Umbraco instance to another.
Hi Denis.
Check out Kevin's answer in this thread: https://our.umbraco.org/forum/developers/api-questions/47792-Create-Media-Programmatically-in-V7#comment-170995
I think that might be what you're looking for.
Best of luck!
is working on a reply...