You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 15/umbraco-cms/reference/management/using-services/contentservice.md
+22-13Lines changed: 22 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
description: Example on how to create and publish content programmatically using the ContentService.
2
+
description: Example on how to create and publish content programmatically using the `IContentService`.
3
3
---
4
4
5
5
# Content Service
@@ -8,7 +8,9 @@ Learn how to use the Content Service.
8
8
9
9
## Creating content programmatically
10
10
11
-
In the example below, a new page is programmatically created using the content service. It is assumed that there are two document types, namely Catalogue and Product. In this case, a new Product is added underneath the Catalogue page. Add the below code in the Catalogue template.
11
+
In the example below, a new content item is programmatically created using the content service. It is assumed that there are two document types, namely *Catalogue* and *Product*. A new *Product* node will be created under the *Catalogue* page.
12
+
13
+
Create a new C# class file (for example, `MyProject/Services/PublishContentDemo.cs`) inside your web project.
12
14
13
15
```csharp
14
16
usingUmbraco.Cms.Core.Models;
@@ -36,9 +38,12 @@ public class PublishContentDemo
36
38
// Set the value of the property with alias 'price'
Copy file name to clipboardExpand all lines: 16/umbraco-cms/reference/management/using-services/contentservice.md
+22-13Lines changed: 22 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
description: Example on how to create and publish content programmatically using the ContentService.
2
+
description: Example on how to create and publish content programmatically using the `IContentService`.
3
3
---
4
4
5
5
# Content Service
@@ -8,7 +8,9 @@ Learn how to use the Content Service.
8
8
9
9
## Creating content programmatically
10
10
11
-
In the example below, a new page is programmatically created using the content service. It is assumed that there are two document types, namely Catalogue and Product. In this case, a new Product is added underneath the Catalogue page. Add the below code in the Catalogue template.
11
+
In the example below, a new content item is programmatically created using the content service. It is assumed that there are two document types, namely *Catalogue* and *Product*. A new *Product* node will be created under the *Catalogue* page.
12
+
13
+
Create a new C# class file (for example, `MyProject/Services/PublishContentDemo.cs`) inside your web project.
12
14
13
15
```csharp
14
16
usingUmbraco.Cms.Core.Models;
@@ -36,9 +38,12 @@ public class PublishContentDemo
36
38
// Set the value of the property with alias 'price'
Copy file name to clipboardExpand all lines: 17/umbraco-cms/reference/management/using-services/contentservice.md
+22-13Lines changed: 22 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
description: Example on how to create and publish content programmatically using the ContentService.
2
+
description: Example on how to create and publish content programmatically using the `IContentService`.
3
3
---
4
4
5
5
# Content Service
@@ -8,7 +8,9 @@ Learn how to use the Content Service.
8
8
9
9
## Creating content programmatically
10
10
11
-
In the example below, a new page is programmatically created using the content service. It is assumed that there are two document types, namely Catalogue and Product. In this case, a new Product is added underneath the Catalogue page. Add the below code in the Catalogue template.
11
+
In the example below, a new content item is programmatically created using the content service. It is assumed that there are two document types, namely *Catalogue* and *Product*. A new *Product* node will be created under the *Catalogue* page.
12
+
13
+
Create a new C# class file (for example, `MyProject/Services/PublishContentDemo.cs`) inside your web project.
12
14
13
15
```csharp
14
16
usingUmbraco.Cms.Core.Models;
@@ -36,9 +38,12 @@ public class PublishContentDemo
36
38
// Set the value of the property with alias 'price'
0 commit comments