From e2b9c913aa55bd4e90773190caa9e3a0b83476af Mon Sep 17 00:00:00 2001 From: "Alina-Magdalena Tincas (Umbraco HQ)" Date: Tue, 26 Mar 2024 15:54:41 +0100 Subject: [PATCH 01/16] update services articles in v14 --- .../reference/management/services/README.md | 90 ++++++++++++++++++- .../management/services/auditservice.md | 48 ---------- .../management/services/datatypeservice.md | 48 ---------- .../management/services/domainservice.md | 48 ---------- .../management/services/entityservice.md | 48 ---------- .../services/externalloginservice.md | 42 --------- .../management/services/fileservice.md | 48 ---------- .../management/services/membergroupservice.md | 48 ---------- .../management/services/memberservice.md | 48 ---------- .../management/services/membertypeservice.md | 48 ---------- .../services/notificationservice.md | 42 --------- .../management/services/packagingservice.md | 42 --------- .../services/publicaccessservice.md | 42 --------- .../management/services/redirecturlservice.md | 42 --------- .../services/serverregistrationservice.md | 50 ----------- .../management/services/tagservice.md | 42 --------- .../management/services/textservice.md | 42 --------- 17 files changed, 89 insertions(+), 729 deletions(-) delete mode 100644 14/umbraco-cms/reference/management/services/auditservice.md delete mode 100644 14/umbraco-cms/reference/management/services/datatypeservice.md delete mode 100644 14/umbraco-cms/reference/management/services/domainservice.md delete mode 100644 14/umbraco-cms/reference/management/services/entityservice.md delete mode 100644 14/umbraco-cms/reference/management/services/externalloginservice.md delete mode 100644 14/umbraco-cms/reference/management/services/fileservice.md delete mode 100644 14/umbraco-cms/reference/management/services/membergroupservice.md delete mode 100644 14/umbraco-cms/reference/management/services/memberservice.md delete mode 100644 14/umbraco-cms/reference/management/services/membertypeservice.md delete mode 100644 14/umbraco-cms/reference/management/services/notificationservice.md delete mode 100644 14/umbraco-cms/reference/management/services/packagingservice.md delete mode 100644 14/umbraco-cms/reference/management/services/publicaccessservice.md delete mode 100644 14/umbraco-cms/reference/management/services/redirecturlservice.md delete mode 100644 14/umbraco-cms/reference/management/services/serverregistrationservice.md delete mode 100644 14/umbraco-cms/reference/management/services/tagservice.md delete mode 100644 14/umbraco-cms/reference/management/services/textservice.md diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index 1b70c6ba226..c82efe72ced 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -1 +1,89 @@ -# Services Reference +--- +description: Here you can find the references of all available services and how to get them. +--- + +# Services References + +Below you can find a list of most common services: + +## [AuditService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IAuditService.html) + +## [ConsentService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IConsentService.html) + +## [DataTypeService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IDataTypeService.html) + +## [DomainService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IDomainService.html) + +## [EntityService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IEntityService.html) + +## [ExternalLoginService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ExternalLoginService.html) + +## [FileService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IFileService.html) + +## [MediaService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IMediaService.html) + +## [MemberGroupService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMemberGroupService.html) + +## [MemberService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IMemberService.html) + +## [MemberTypeService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IMemberTypeService.html) + +## [NotificationService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.INotificationService.html) + +## [PackagingService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IPackagingService.html) + +## [PublicAccessService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IPublicAccessService.html) + +## [RedirectUrlService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IRedirectUrlService.html) + +## [RelationService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IRelationService.html) + +## [ServerRegistrationService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IServerRegistrationService.html) + +## [TagService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ITagService.html) + +## [TextService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ILocalizedTextService.html) + +## [ContentService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentService.html) + +## [ContentTypeService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentTypeService.html) + +## [LocalizationService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ILocalizationService.html) + +## [UserService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IUserService.html) + +You can find a list of all supported services in the [API Docs](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.html). + +# Getting a Service + +All services can be accessed with the following using statement: + +```csharp +using Umbraco.Cms.Core.Services; +``` + +In other cases, you may be able to use **Dependency Injection**. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the service interface in your constructor. + +For example, if you use a `NotificationService` you can use Dependency Injection via the `INotificationService` interface like this: + +```csharp +public class MyClass +{ + private INotificationService _notificationService; + + public MyClass(INotificationService notificationService) + { + _notificationService = notificationService; + } +} +``` + +In Razor views, you can access the Notification Service through the `@inject` directive: + +```csharp +@inject INotificationService NotificationService +``` + +{% hint style="info" %} +The same example can be used for the other service where you can replace the interface and service name. +{% endhint %} diff --git a/14/umbraco-cms/reference/management/services/auditservice.md b/14/umbraco-cms/reference/management/services/auditservice.md deleted file mode 100644 index 612f616a41f..00000000000 --- a/14/umbraco-cms/reference/management/services/auditservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# AuditService - -The AuditService acts as a "gateway" to Umbraco data for operations which are related to the audit trail. - -[Browse the API documentation for IAuditService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IAuditService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the audit service in a class, you need to use Dependency Injection (DI). For instance if you have registered your own class in Umbraco's DI container, you can specify the `IAuditService` interface in your constructor: - -```csharp -public class MyClass -{ - private IAuditService _auditService; - - public MyClass(IAuditService auditService) - { - _auditService = auditService; - } -} -``` - -In Razor views, you can access the audit service through the `@inject` directive: - -```csharp -@inject IAuditService AuditService -``` diff --git a/14/umbraco-cms/reference/management/services/datatypeservice.md b/14/umbraco-cms/reference/management/services/datatypeservice.md deleted file mode 100644 index d9ea0dd4db2..00000000000 --- a/14/umbraco-cms/reference/management/services/datatypeservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# DataTypeService - -The DataTypeService acts as a "gateway" to Umbraco data for operations which are related to DataTypes and DataTypeDefinitions. - -[Browse the API documentation for IDataTypeService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IDataTypeService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the Data Type service in a class, you need to specify the `IDataTypeService` interface in your constructor: - -```csharp -public class MyClass -{ - private IDataTypeService _dataTypeService; - - public MyClass(IDataTypeService dataTypeService) - { - _dataTypeService = dataTypeService; - } -} -``` - -In Razor views, you can access the Data Type service through the `@inject` directive: - -```csharp -@inject IDataTypeService DataTypeService -``` diff --git a/14/umbraco-cms/reference/management/services/domainservice.md b/14/umbraco-cms/reference/management/services/domainservice.md deleted file mode 100644 index feff49f4777..00000000000 --- a/14/umbraco-cms/reference/management/services/domainservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# DomainService - -The DomainService acts as a "gateway" to Umbraco data for operations which are related to domains. - -[Browse the API documentation for IDomainService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IDomainService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the domain service in a class, you need to specify the `IDomainService` interface in your constructor: - -```csharp -public class MyClass -{ - private IDomainService _domainService; - - public MyClass(IDomainService domainService) - { - _domainService = domainService; - } -} -``` - -In Razor views, you can access the domain service through the `@inject` directive: - -```csharp -@inject IDomainService DomainService -``` diff --git a/14/umbraco-cms/reference/management/services/entityservice.md b/14/umbraco-cms/reference/management/services/entityservice.md deleted file mode 100644 index da4c4ea71cd..00000000000 --- a/14/umbraco-cms/reference/management/services/entityservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# EntityService - -The EntityService acts as a "gateway" to Umbraco data for operations which are related to entities. - -[Browse the API documentation for IEntityService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IEntityService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the entity service in a class, you need to specify the `IEntityService` interface in your constructor: - -```csharp -public class MyClass -{ - private IEntityService _entityService; - - public MyClass(IEntityService entityService) - { - _entityService = entityService; - } -} -``` - -In Razor views, you can access the entity service through the `@inject` directive: - -```csharp -@inject IEntityService EntityService -``` diff --git a/14/umbraco-cms/reference/management/services/externalloginservice.md b/14/umbraco-cms/reference/management/services/externalloginservice.md deleted file mode 100644 index c757aac919c..00000000000 --- a/14/umbraco-cms/reference/management/services/externalloginservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# ExternalLoginService - -The ExternalLoginService is used to store the external login info and can be replaced with your own implementation. - -[Browse the API documentation for IEntityService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IExternalLoginService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the entity service in a class, you need to specify the `IExternalLoginService` interface in your constructor: - -```csharp -public class MyClass -{ - private IExternalLoginService _externalLoginService; - - public MyClass(IExternalLoginService externalLoginService) - { - _externalLoginService = externalLoginService; - } -} -``` - -In Razor views, you can access the entity service through the `@inject` directive: - -```csharp -@inject IExternalLoginService ExternalLoginService -``` diff --git a/14/umbraco-cms/reference/management/services/fileservice.md b/14/umbraco-cms/reference/management/services/fileservice.md deleted file mode 100644 index 076b97166c8..00000000000 --- a/14/umbraco-cms/reference/management/services/fileservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# FileService - -The FileService acts as a "gateway" to Umbraco data for operations which are related to Scripts, Stylesheets and Templates. - -[Browse the API documentation for IFileService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IFileService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the file service in a class, you need to specify the `IFileService` interface in your constructor: - -```csharp -public class MyClass -{ - private IFileService _fileService; - - public MyClass(IFileService fileService) - { - _fileService = fileService; - } -} -``` - -In Razor views, you can access the file service through the `@inject` directive: - -```csharp -@inject IFileService FileService -``` diff --git a/14/umbraco-cms/reference/management/services/membergroupservice.md b/14/umbraco-cms/reference/management/services/membergroupservice.md deleted file mode 100644 index b7e20cc32a0..00000000000 --- a/14/umbraco-cms/reference/management/services/membergroupservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# MemberGroupService - -The MemberGroupService acts as a "gateway" to Umbraco data for operations which are related to Member groups, which are also known as Member Roles. - -[Browse the API documentation for IMemberGroupService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMemberGroupService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the member group service in a class, you need to specify the `IMemberGroupService` interface in your constructor: - -```csharp -public class MyClass -{ - private IMemberGroupService _memberGroupService; - - public MyClass(IMemberGroupService memberGroupService) - { - _memberGroupService = memberGroupService; - } -} -``` - -In Razor views, you can access the member group service through the `@inject` directive: - -```csharp -@inject IMemberGroupService MemberGroupService -``` diff --git a/14/umbraco-cms/reference/management/services/memberservice.md b/14/umbraco-cms/reference/management/services/memberservice.md deleted file mode 100644 index 0e6913ddbf7..00000000000 --- a/14/umbraco-cms/reference/management/services/memberservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# MemberService - -The MemberService acts as a "gateway" to Umbraco data for operations which are related to Members. - -[Browse the API documentation for IMemberService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMemberService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the member service in a class, you need to specify the `IMemberService` interface in your constructor: - -```csharp -public class MyClass -{ - private IMemberService _memberService; - - public MyClass(IMemberService memberService) - { - _memberService = memberService; - } -} -``` - -In Razor views, you can access the member service through the `@inject` directive: - -```csharp -@inject IMemberService MemberService -``` diff --git a/14/umbraco-cms/reference/management/services/membertypeservice.md b/14/umbraco-cms/reference/management/services/membertypeservice.md deleted file mode 100644 index e1f6cb3adaf..00000000000 --- a/14/umbraco-cms/reference/management/services/membertypeservice.md +++ /dev/null @@ -1,48 +0,0 @@ -# MemberTypeService - -The MemberTypeService acts as a "gateway" to Umbraco data for operations which are related to MemberTypes. - -[Browse the API documentation for IMemberTypeService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMemberTypeService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the member type service in a class, you need to specify the `IMemberTypeService` interface in your constructor: - -```csharp -public class MyClass -{ - private IMemberTypeService _memberTypeService; - - public MyClass(IMemberTypeService memberTypeService) - { - _memberTypeService = memberTypeService; - } -} -``` - -In Razor views, you can access the member type service through the `@inject` directive: - -```csharp -@inject IMemberTypeService MemberTypeService -``` diff --git a/14/umbraco-cms/reference/management/services/notificationservice.md b/14/umbraco-cms/reference/management/services/notificationservice.md deleted file mode 100644 index 62f420e0693..00000000000 --- a/14/umbraco-cms/reference/management/services/notificationservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# NotificationService - -The NotificationServices is used to perform operations related to backoffice notifications. - -[Browse the API documentation for INotificationService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.INotificationService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `INotificationService` interface in your constructor: - -```csharp -public class MyClass -{ - private INotificationService _notificationService; - - public MyClass(INotificationService notificationService) - { - _notificationService = notificationService; - } -} -``` - -In Razor views, you can access the member type service through the `@inject` directive: - -```csharp -@inject INotificationService NotificationService -``` diff --git a/14/umbraco-cms/reference/management/services/packagingservice.md b/14/umbraco-cms/reference/management/services/packagingservice.md deleted file mode 100644 index 7b20b129fb0..00000000000 --- a/14/umbraco-cms/reference/management/services/packagingservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# PackagingService - -The PackagingService provides import/export functionality for the Core models of the API. - -[Browse the API documentation for IPackagingService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IPackagingService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `IPackagingService` interface in your constructor: - -```csharp -public class MyClass -{ - private IPackagingService _packagingService; - - public MyClass(IPackagingService packagingService) - { - _packagingService = packagingService; - } -} -``` - -In Razor views, you can access the member service through the `@inject` directive: - -```csharp -@inject IPackagingService PackagingService -``` diff --git a/14/umbraco-cms/reference/management/services/publicaccessservice.md b/14/umbraco-cms/reference/management/services/publicaccessservice.md deleted file mode 100644 index 1d45df75f8d..00000000000 --- a/14/umbraco-cms/reference/management/services/publicaccessservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# PublicAccessService - -Service to handle public access. - -[Browse the API documentation for IPublicAccessService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IPublicAccessService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `IPublicAccessService` interface in your constructor: - -```csharp -public class MyClass -{ - private IPublicAccessService _publicAccessService; - - public MyClass(IPublicAccessService publicAccessService) - { - _publicAccessService = publicAccessService; - } -} -``` - -In Razor views, you can access the member service through the `@inject` directive: - -```csharp -@inject IPublicAccessService PublicAccessService -``` diff --git a/14/umbraco-cms/reference/management/services/redirecturlservice.md b/14/umbraco-cms/reference/management/services/redirecturlservice.md deleted file mode 100644 index 37058c761c8..00000000000 --- a/14/umbraco-cms/reference/management/services/redirecturlservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# RedirectUrlService - -The RedirectUrlService is used for Create, Read, Update and Delete (CRUD) operations related to Redirects. - -[Browse the API documentation for IRedirectUrlService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IRedirectUrlService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `IRedirectUrlService` interface in your constructor: - -```csharp -public class MyClass -{ - private IRedirectUrlService _redirectUrlService; - - public MyClass(IRedirectUrlService redirectUrlService) - { - _redirectUrlService = redirectUrlService; - } -} -``` - -In Razor views, you can access the member service through the `@inject` directive: - -```csharp -@inject IRedirectUrlService RedirectUrlService -``` diff --git a/14/umbraco-cms/reference/management/services/serverregistrationservice.md b/14/umbraco-cms/reference/management/services/serverregistrationservice.md deleted file mode 100644 index 478ae8c0cf2..00000000000 --- a/14/umbraco-cms/reference/management/services/serverregistrationservice.md +++ /dev/null @@ -1,50 +0,0 @@ -# ServerRegistrationService - -The ServerRegistrationService manages server registrations in the database. - -[Browse the API documentation for IServerRegistrationService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IServerRegistrationService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -The Umbraco.Core.dll allows you to reference the Constants classes used in the below examples. - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the server registration service in a class, you need to specify the IServerRegistrationService interface in your constructor: - -```csharp -public class MyClass -{ - private IServerRegistrationService _serverRegistrationService; - - public MyClass(IServerRegistrationService serverRegistrationService) - { - _serverRegistrationService = serverRegistrationService; - } -} -``` - -In Razor views, you can access the server registration service through the @inject directive: - -```csharp -@inject IServerRegistrationService ServerRegistrationService -``` diff --git a/14/umbraco-cms/reference/management/services/tagservice.md b/14/umbraco-cms/reference/management/services/tagservice.md deleted file mode 100644 index a49eab65e33..00000000000 --- a/14/umbraco-cms/reference/management/services/tagservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# TagService - -Tag service to query for tags in the tags db table. - -[Browse the API documentation for ITagService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.ITagService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `ITagService` interface in your constructor: - -```csharp -public class MyClass -{ - private ITagService _tagService; - - public MyClass(ITagService tagService) - { - _tagService = tagService; - } -} -``` - -In Razor views, you can access the member service through the `@inject` directive: - -```csharp -@inject ITagService TagService -``` diff --git a/14/umbraco-cms/reference/management/services/textservice.md b/14/umbraco-cms/reference/management/services/textservice.md deleted file mode 100644 index 8bc0e7dc7d9..00000000000 --- a/14/umbraco-cms/reference/management/services/textservice.md +++ /dev/null @@ -1,42 +0,0 @@ -# TextService - -The TextService is the entry point to localize any key in the text storage source for a given culture. - -[Browse the API documentation for ILocalizedTextService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.ILocalizedTextService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -## Getting the service - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `ILocalizedTextService` interface in your constructor: - -```csharp -public class MyClass -{ - private ILocalizedTextService _textService; - - public MyClass(ILocalizedTextService textService) - { - _textService = textService; - } -} -``` - -In Razor views, you can access the member service through the `@inject` directive: - -```csharp -@inject ILocalizedTextService LocalizedTextService -``` From b5ae9c24361b8786e48e4e6c004accd3b416ab37 Mon Sep 17 00:00:00 2001 From: "Alina-Magdalena Tincas (Umbraco HQ)" Date: Wed, 27 Mar 2024 10:55:31 +0100 Subject: [PATCH 02/16] moving examples to the root --- .../reference/management/services/README.md | 21 +- .../management/services/consentservice.md | 13 +- .../services/contentservice/README.md | 45 --- .../services/contenttypeservice/README.md | 53 ---- .../retrieving-content-type-containers.md | 42 --- .../{userservice => }/create-a-new-user.md | 25 +- .../create-content-programmatically.md | 9 +- .../services/localizationservice/README.md | 53 ---- .../management/services/mediaservice.md | 48 +-- .../management/services/relationservice.md | 279 +----------------- .../retrieving-content-types.md | 47 +++ .../retrieving-languages.md | 12 +- .../management/services/userservice/README.md | 59 ---- 13 files changed, 118 insertions(+), 588 deletions(-) delete mode 100644 14/umbraco-cms/reference/management/services/contentservice/README.md delete mode 100644 14/umbraco-cms/reference/management/services/contenttypeservice/README.md delete mode 100644 14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-type-containers.md rename 14/umbraco-cms/reference/management/services/{userservice => }/create-a-new-user.md (54%) rename 14/umbraco-cms/reference/management/services/{contentservice => }/create-content-programmatically.md (89%) delete mode 100644 14/umbraco-cms/reference/management/services/localizationservice/README.md rename 14/umbraco-cms/reference/management/services/{contenttypeservice => }/retrieving-content-types.md (64%) rename 14/umbraco-cms/reference/management/services/{localizationservice => }/retrieving-languages.md (91%) delete mode 100644 14/umbraco-cms/reference/management/services/userservice/README.md diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index c82efe72ced..76d4b59fe58 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -1,5 +1,5 @@ --- -description: Here you can find the references of all available services and how to get them. +description: List of services references, how to use them and some examples. --- # Services References @@ -62,7 +62,7 @@ All services can be accessed with the following using statement: using Umbraco.Cms.Core.Services; ``` -In other cases, you may be able to use **Dependency Injection**. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the service interface in your constructor. +In other cases, you may be able to use [Dependency Injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection). For instance if you have registered your own class in Umbraco's dependency injection, you can specify the service interface in your constructor. For example, if you use a `NotificationService` you can use Dependency Injection via the `INotificationService` interface like this: @@ -87,3 +87,20 @@ In Razor views, you can access the Notification Service through the `@inject` di {% hint style="info" %} The same example can be used for the other service where you can replace the interface and service name. {% endhint %} + +# Samples + +* [Consent Service Example](./consentservice.md) +Example of how to work with a Consent. +* [User Service Example](./create-a-new-user.md) +Example of adding a user to a user group. +* [Content Service Example](./create-content-programmatically.md) +Example of creating content programmatically. +* [Media Service Example](./mediaservice.md) +Examples of how to create a new folder and a new media item from a stream. +* [Relation Service Example](./relationservice.md) +Example of how to automatically relate to root node. +* [Content Type Service Example](./retrieving-content-types.md) +Examples of how to retrieve content types and content type containers. +* [Localization Service Example](./retrieving-languages.md) +Example on how to retrieve languages. diff --git a/14/umbraco-cms/reference/management/services/consentservice.md b/14/umbraco-cms/reference/management/services/consentservice.md index 029d0105ed8..5a9589073b6 100644 --- a/14/umbraco-cms/reference/management/services/consentservice.md +++ b/14/umbraco-cms/reference/management/services/consentservice.md @@ -1,10 +1,5 @@ # ConsentService -[Browse the API documentation for ConsentService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IConsentService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - A service for handling lawful data processing requirements. ## What is a Consent @@ -17,7 +12,7 @@ Consent can be given or revoked or changed via the `RegisterConsent` method, whi ## Get the current state -Getter methods of this service return the current state of a consent, that is the latest [IConsent](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Models.IConsent.html) entity that was created. +Getter methods of this service return the current state of a consent, that is the latest [IConsent](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Models.IConsent.html) entity that was created. ## Revoking a consent @@ -46,9 +41,3 @@ if (consents != null && consents.Any()) } } ``` - -In Razor views, you can access the consent service through the `@inject` directive: - -```csharp -@inject IConsentService ConsentService -``` diff --git a/14/umbraco-cms/reference/management/services/contentservice/README.md b/14/umbraco-cms/reference/management/services/contentservice/README.md deleted file mode 100644 index a9d8824bce7..00000000000 --- a/14/umbraco-cms/reference/management/services/contentservice/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# ContentService - -The ContentService acts as a "gateway" to Umbraco data for operations which are related to Content. - -[Browse the v13 API documentation for ContentService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IContentService.html). - - * **Namespace:** `Umbraco.Cms.Core.Services` - * **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -If you wish to use the content service in a class, you need to use Dependency Injection (DI) in your constructor: - -```csharp -public class MyClass -{ - private IContentService _contentService; - - public MyClass(IContentService contentService) - { - _contentService = contentService; - } -} -``` - -In Razor views, you can access the content service through the `@inject` directive: - -```csharp -@inject IContentService ContentService -``` diff --git a/14/umbraco-cms/reference/management/services/contenttypeservice/README.md b/14/umbraco-cms/reference/management/services/contenttypeservice/README.md deleted file mode 100644 index 4a6b662508f..00000000000 --- a/14/umbraco-cms/reference/management/services/contenttypeservice/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# ContentTypeService - -The content type service acts as a "gateway" to Umbraco data for operations which are related to both content types and media types. - -[Browse the API documentation for IContentTypeService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IContentTypeService.html). - - * **Namespace:** `Umbraco.Cms.Core.Services` - * **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the content type service in a class, you need to specify the `IContentTypeService` interface in your constructor: - -```csharp -public class MyClass -{ - private IContentTypeService _contentTypeService; - - public MyClass(IContentTypeService contentTypeService) - { - _contentTypeService = contentTypeService; - } -} -``` - -In Razor views, you can access the content type service through the `@inject` directive: - -```csharp -@inject IContentTypeService ContentTypeService -``` - -## Samples - -* [**Retrieving content types**](retrieving-content-types.md)
See examples on how to retrieve content types via the service - either individually or as a collection. - -* [**Retrieving content type containers**](retrieving-content-type-containers.md)
See examples on how to retrieve content type containers (folders) via the service - either individually or as a collection. diff --git a/14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-type-containers.md b/14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-type-containers.md deleted file mode 100644 index 6bfdb0d2d20..00000000000 --- a/14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-type-containers.md +++ /dev/null @@ -1,42 +0,0 @@ -# Retrieving content types - -## Getting a single content type container - -Content types can be added either at the root level, under another content type or under a content type container (or folders as they're called in the Umbraco backoffice). The approach for getting a single container is similar to getting a single content type, meaning that you can look up a container - either by its GUID: - -```csharp -// Declare the GUID ID -Guid guid = new Guid("d3b9cc9a-d471-4465-a89a-112c6bc1e5b4"); - -// Get a container by its GUID ID -EntityContainer container = _contentTypeService.GetContainer(guid); -``` - -or its numeric counterpart: - -```csharp -// Get a container by its numeric ID -EntityContainer container = _contentTypeService.GetContainer(1090); -``` - -## Getting a list of content type containers - -In the same way as you can get the content types of a container, you can get the child containers of another container. This is done by calling the `GetContainers` method with an array of numeric IDs: - -```csharp -// Declare the array of IDs to lookup -int[] ids = new[] {1090}; - -// Get the child containers via the content type service -IEnumerable containers = _contentTypeService.GetContainers(ids); -``` - -Also, if the array is empty, all containers will be returned: - -```csharp -// Declare the array of IDs to lookup -int[] ids = new int[0]; - -// Get all content type containers -IEnumerable containers = _contentTypeService.GetContainers(ids); -``` diff --git a/14/umbraco-cms/reference/management/services/userservice/create-a-new-user.md b/14/umbraco-cms/reference/management/services/create-a-new-user.md similarity index 54% rename from 14/umbraco-cms/reference/management/services/userservice/create-a-new-user.md rename to 14/umbraco-cms/reference/management/services/create-a-new-user.md index 996b4a42c8e..46f83fad6bf 100644 --- a/14/umbraco-cms/reference/management/services/userservice/create-a-new-user.md +++ b/14/umbraco-cms/reference/management/services/create-a-new-user.md @@ -1,10 +1,31 @@ --- -description: "This will show you how to create a new user using the UserService in Umbraco." +description: This will show you how to add a user to a user group using the UserService in Umbraco. --- + +# Getting the service + +## Services property + +If you wish to use the UserService in a class that inherits from one of the Umbraco base classes (eg. `SurfaceController`, `UmbracoApiController` or `UmbracoAuthorizedApiController`), you can access the service through a local `Services` property: + +```csharp +IUserService userService = Services.UserService; +``` + +## Static accessor + +If neither a `Services` property or Dependency Injection is available, you can also reference the static `Current` class directly: + +```csharp +IUserService userService = Umbraco.Core.Composing.Current.Services.UserService; +``` + # Creating a user + If you want to create a new user, you'd use ASP.NET identity APIs like it is used in core. -### Assigning the user to a user group +## Assigning the user to a user group + Permissions aren't administered for the specific user, but rather for the user group(s) that the user is a part of. So to add our new user to a user group, we first need to get a reference to the user via the `GetUserGroupByAlias` method, and then use the `AddGroup` method for adding the group to our user: ```csharp diff --git a/14/umbraco-cms/reference/management/services/contentservice/create-content-programmatically.md b/14/umbraco-cms/reference/management/services/create-content-programmatically.md similarity index 89% rename from 14/umbraco-cms/reference/management/services/contentservice/create-content-programmatically.md rename to 14/umbraco-cms/reference/management/services/create-content-programmatically.md index f0f10a749c9..9a66151f726 100644 --- a/14/umbraco-cms/reference/management/services/contentservice/create-content-programmatically.md +++ b/14/umbraco-cms/reference/management/services/create-content-programmatically.md @@ -1,3 +1,7 @@ +--- +description: Example on how to create content programmatically using the ContentService. +--- + # Create content programmatically 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. @@ -23,8 +27,9 @@ In the example below, a new page is programmatically created using the content s // Save and publish the child item ContentService.SaveAndPublish(demoproduct); - ``` + } +``` In a multilanguage setup, it is necessary to set the name of the content item for a specified culture: @@ -33,4 +38,4 @@ demoproduct.SetCultureName("Microphone", "en-us"); // this will set the english demoproduct.SetCultureName("Mikrofon", "da"); // this will set the danish name ``` -For information on how to retrieve multilingual languages, see the [Retrieving languages](../localizationservice/retrieving-languages.md) article. +For information on how to retrieve multilingual languages, see the [Retrieving languages](./retrieving-languages.md) article. diff --git a/14/umbraco-cms/reference/management/services/localizationservice/README.md b/14/umbraco-cms/reference/management/services/localizationservice/README.md deleted file mode 100644 index 04eca4c9ea7..00000000000 --- a/14/umbraco-cms/reference/management/services/localizationservice/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# LocalizationService - -The LocalizationService acts as a "gateway" to Umbraco data for operations which are related to Dictionary items and Languages. - -[Browse the API documentation for ILocalizationService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.ILocalizationService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the localization service in a class, you need to specify the `ILocalizationService` interface in your constructor: - -```csharp -public class MyClass -{ - private ILocalizationService _localizationService; - - public MyClass(ILocalizationService localizationService) - { - _localizationService = localizationService; - } -} -``` - -In Razor views, you can access the localization service through the `@inject` directive: - -```csharp -@inject ILocalizationService LocalizationService -``` - -## Samples - -* [**Retrieving languages**](retrieving-languages.md)\ - See examples on how to retrieve languages via the localization service - either individually or as a collection. diff --git a/14/umbraco-cms/reference/management/services/mediaservice.md b/14/umbraco-cms/reference/management/services/mediaservice.md index 33675e75a1c..d695049e016 100644 --- a/14/umbraco-cms/reference/management/services/mediaservice.md +++ b/14/umbraco-cms/reference/management/services/mediaservice.md @@ -1,15 +1,10 @@ -# MediaService +--- +description: Examples on how to create a new folder and a new media item from a stream by using the MediaService. +--- -The MediaService acts as a "gateway" to Umbraco data for operations which are related to media. +# Samples -[Browse the API documentation for IMediaService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMediaService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require reference to the following packages: - -* [`Umbraco.Cms.Core`](https://www.nuget.org/packages/Umbraco.Cms.Core/) +In this article, you can find some examples on how to create a new media folder and a media item from a stream programmatically. Samples in this document will require the following using statements: @@ -23,33 +18,7 @@ using Umbraco.Cms.Core.Strings; using Umbraco.Extensions; ``` -## Getting the service - -### Dependency Injection - -If you wish to use the media service in a class, you need to specify the `IMediaService` interface in your constructor: - -```csharp -public class MyClass -{ - private IMediaService _mediaService; - - public MyClass(IMediaService mediaService) - { - _mediaService = mediaService; - } -} -``` - -In Razor views, you can access the media service through the `@inject` directive: - -```csharp -@inject IMediaService MediaService -``` - -## Samples - -### Creating a new folder +## Creating a new folder To create a new folder at the root of the media archive, your code could look like the following: @@ -79,14 +48,14 @@ The third parameter is the alias of the Media Type. As Umbraco comes with a Fold Besides the three mandatory parameters, you can specify a user's numeric ID for media creation attribution. Unspecified cases default to the "Administrator" user with ID `-1`. -### Creating a new media item from a stream +## Creating a new media item from a stream You can specify a `Stream` for the contents of the file that should be created. As an example, if you have an image on disk named `unicorn.jpg` in the images folder of `wwwroot`. You can open a new stream for a file on the disk, and then create a new media item for that file in Umbraco: - Please be aware that you will need to inject the following services: + * `MediaFileManager _mediaFileManager` * `IShortStringHelper _shortStringHelper` * `IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider` @@ -109,7 +78,6 @@ using (Stream stream = System.IO.File.OpenRead(path)) // Save the media var result = _mediaService.Save(media); } -} ``` Again Umbraco will make sure the necessary properties are updated. diff --git a/14/umbraco-cms/reference/management/services/relationservice.md b/14/umbraco-cms/reference/management/services/relationservice.md index e08a1439be1..7c8ca5b6f57 100644 --- a/14/umbraco-cms/reference/management/services/relationservice.md +++ b/14/umbraco-cms/reference/management/services/relationservice.md @@ -1,285 +1,16 @@ # RelationService -The `RelationService` is pretty awesome as it allows you to create relations between objects that would otherwise have no obvious connection. +The `RelationService` allows you to create relations between objects that would otherwise have no obvious connection. -[Browse the API documentation for IRelationService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IRelationService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - -## Getting the service - -```csharp -using System.Web.Mvc; -using Umbraco.Web.Models; -using Umbraco.Web.Mvc; - -using Umbraco.Cms.Core.Services; - -```csharp -public class MyClass -{ - private IRelationService _relationService_; - - public MyClass(IRelationService relationService) - { - _relationService_ = relationService; - } -``` - -## Methods - -### AreRelated(int parentId, int childId, string relationTypeAlias) - -Checks if two items are related. - -Returns `bool`. - -### AreRelated(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias) - -Checks if two items are related. - -Returns `bool`. - -### AreRelated(int parentId, int childId) - -Checks if two items are related. - -Returns `bool`. - -### Delete(IRelation relation) - -Deletes a relation. - -Returns `void`. - -### Delete(IRelationType relationType) - -Deletes a relation type. - -Returns `void`. - -### DeleteRelationsOfType(IRelationType relationType) - -Deletes relation of the specified relation type. - -Returns `void`. - -### GetAllRelations(params int\[] ids) - -Gets a collection of `Umbraco.Core.Models.Relation` objects. Optional array of integer ids to return relations for. - -Returns `IEnumerable`. - -### GetAllRelationsByRelationType(RelationType relationType) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their relation type. - -Returns `IEnumerable`. - -### GetAllRelationsByRelationType(int relationTypeId) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their relation type id. - -Returns `IEnumerable`. - -### GetAllRelationTypes(params int\[] ids) - -Gets a collection of `Umbraco.Core.Models.Relation` objects. Optional array of integer ids to return relationtypes for. - -Returns `IEnumerable`. - -### GetByChild(IUmbracoEntity child) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their child entity. - -Returns `IEnumerable`. - -### GetByChild(IUmbracoEntity child, string relationTypeAlias) - -Gets a collection of `Umbraco.Core.Models.Relation` objects their child entity and relation type alias. - -Returns `IEnumerable`. - -### GetByChildId(int id) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their child id. - -Returns `IEnumerable`. - -### GetById(int id) - -Gets a `Umbraco.Core.Models.Relation` object by its id. - -Returns `IRelation`. - -### GetByParent(IUmbracoEntity parent, string relationTypeAlias) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their parent entity and relation type alias. - -Returns `IEnumerable`. - -### GetByParent(IUmbracoEntity parent) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their parent entity. - -Returns `IEnumerable`. - -### GetByParentId(int id) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their parent id. - -Returns `IEnumerable`. - -### GetByParentOrChildId(int id, string relationTypeAlias) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their parent or child id and relation type alias. - -Returns `IEnumerable`. - -{% hint style="info" %} -Using this method will get you all relations regards of it being a child or parent relation. -{% endhint %} - -### GetByParentOrChildId(int id) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their parent or child id. - -Returns `IEnumerable`. - -{% hint style="info" %} -Using this method will get you all relations regards of it being a child or parent relation. -{% endhint %} - -### GetByRelationTypeAlias(string relationTypeAlias) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by their relation type alias. - -Returns `IEnumerable`. - -### GetByRelationTypeId(int relationTypeId) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by the id of their relation type. - -Returns `IEnumerable`. - -### GetByRelationTypeName(string relationTypeName) - -Gets a collection of `Umbraco.Core.Models.Relation` objects by the name of their relation type. - -Returns `IEnumerable`. - -### GetChildEntitiesFromRelations(IEnumerable relations) - -Gets the child objects from a collection of `IRelation` as a collection of `Umbraco.Core.Models.Entities.IUmbracoEntity`. - -Returns `IEnumerable`. - -### GetChildEntityFromRelation(IRelation relation) - -Gets the child object from a relation as an `Umbraco.Core.Models.Entities.IUmbracoEntity` object. - -Returns `IUmbracoEntity`. - -### GetEntitiesFromRelation(IRelation relation) - -Gets the parent and child objects from a relation as a `System.Tuple` with `Umbraco.Core.Models.Entities.IUmbracoEntity`. - -Returns `Tuple`. - -### GetEntitiesFromRelations(IEnumerable relations) - -Gets the parent and child objects from a collection of relations as a list of `Umbraco.Core.Models.Entities.IUmbracoEntity` objects. - -Returns `IEnumerable>`. - -### GetParentEntitiesFromRelations(IEnumerable relations) - -Gets the parent objects from a collection of relations as a collection of `Umbraco.Core.Models.Entities.IUmbracoEntity`. - -Returns `IEnumerable`. - -### GetParentEntityFromRelation(IRelation relation) - -Gets the parent object from a relation as an `Umbraco.Core.Models.Entities.IUmbracoEntity` object. - -### GetRelationTypeByAlias(string alias) - -Gets an relation by its alias. - -Returns `IRelationType`. - -### GetRelationTypeById(Guid id) - -Gets a relation type by its Id - -Returns `IRelationType`. - -### GetRelationTypeById(int id) - -Gets a relation type by its id. - -Returns `IRelationType`. - -### HasRelations(IRelationType relationType) - -Checks if any relations exist for the specified relation type. - -Returns `bool`. - -### IsRelated(int id) - -Checks if any relations exist for the specified id. - -Returns `void`. - -### Relate(int parentId, int childId, IRelationType relationType) - -Relates two objects by their ids using the specified relation type. - -Returns `IRelation`. - -### Relate(IUmbracoEntity parent, IUmbracoEntity child, IRelationType relationType) - -Relates two `IUmbracoEntity` objects using the specified relation type. - -Returns `IRelation`. - -### Relate(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias) - -Relates two `IUmbracoEntity` objects using the specified relation type alias. - -Returns `IRelation`. - -### Relate(int parentId, int childId, string relationTypeAlias) - -Relates two `IUmbracoEntity` objects using the specified relation type alias. - -Returns `IRelation`. - -### Save(IRelation relation) - -Saves a relation. - -Returns `Void`. - -### Save(IRelationType relationType) - -Saves a relation type. - -Returns `Void`. - -## Examples +# Examples Below you will examples using the `RelationService`. -### Automatically relate to root node - -Odd example, I know.. but why not? +## Automatically relate to root node To perform the said task we need a component in which we can register to the `ContentService.Published` event: -([You can read more about composing Umbraco here](../../../implementation/composing.md)) +[You can read more about composing Umbraco here](../../../implementation/composing.md) ```csharp using System.Linq; @@ -357,7 +88,7 @@ If I know `Save and Publish` my `Products` node I get the following result: ![Relations](../../../../../10/umbraco-cms/reference/management/services/images/relations.PNG) -Cool! Now let us try and fetch the data from an API. +Now let us try and fetch the data from an API. ```csharp using System; diff --git a/14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-types.md b/14/umbraco-cms/reference/management/services/retrieving-content-types.md similarity index 64% rename from 14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-types.md rename to 14/umbraco-cms/reference/management/services/retrieving-content-types.md index 97462010476..956593c2f6a 100644 --- a/14/umbraco-cms/reference/management/services/contenttypeservice/retrieving-content-types.md +++ b/14/umbraco-cms/reference/management/services/retrieving-content-types.md @@ -1,3 +1,7 @@ +--- +description: Examples on how to retrieve content types and content type containers using the ContentTypeService. +--- + # Retrieving content types ## Getting a single content type @@ -76,3 +80,46 @@ Although the use of a GUID is preferable, you can also use it's numeric ID: // Check if there are children bool hasChildren = _contentTypeService.HasChildren(1234); ``` + +# Retrieving content type container + +## Getting a single content type container + +Content types can be added either at the root level, under another content type or under a content type container (or folders as they're called in the Umbraco backoffice). The approach for getting a single container is similar to getting a single content type, meaning that you can look up a container - either by its GUID: + +```csharp +// Declare the GUID ID +Guid guid = new Guid("d3b9cc9a-d471-4465-a89a-112c6bc1e5b4"); + +// Get a container by its GUID ID +EntityContainer container = _contentTypeService.GetContainer(guid); +``` + +or its numeric counterpart: + +```csharp +// Get a container by its numeric ID +EntityContainer container = _contentTypeService.GetContainer(1090); +``` + +## Getting a list of content type containers + +In the same way as you can get the content types of a container, you can get the child containers of another container. This is done by calling the `GetContainers` method with an array of numeric IDs: + +```csharp +// Declare the array of IDs to lookup +int[] ids = new[] {1090}; + +// Get the child containers via the content type service +IEnumerable containers = _contentTypeService.GetContainers(ids); +``` + +Also, if the array is empty, all containers will be returned: + +```csharp +// Declare the array of IDs to lookup +int[] ids = new int[0]; + +// Get all content type containers +IEnumerable containers = _contentTypeService.GetContainers(ids); +``` diff --git a/14/umbraco-cms/reference/management/services/localizationservice/retrieving-languages.md b/14/umbraco-cms/reference/management/services/retrieving-languages.md similarity index 91% rename from 14/umbraco-cms/reference/management/services/localizationservice/retrieving-languages.md rename to 14/umbraco-cms/reference/management/services/retrieving-languages.md index 3b563c16a54..4e31f47d66e 100644 --- a/14/umbraco-cms/reference/management/services/localizationservice/retrieving-languages.md +++ b/14/umbraco-cms/reference/management/services/retrieving-languages.md @@ -1,6 +1,10 @@ +--- +description: Example on how to retrieve languages using the LocalizationService. +--- + # Retrieving languages -### Getting a single language +## Getting a single language The localization service contains a number of methods for looking up languages. If you already know the ID of a specific language (eg. the default language has ID `1`), you can use the `GetLanguageById` method to get the reference to that language: @@ -9,7 +13,7 @@ The localization service contains a number of methods for looking up languages. ILanguage language1 = _localizationService.GetLanguageById(1); ``` -Alternative, you can look up a language by its iso code via the `GetLanguageByIsoCode` method: +As an alternative, you can look up a language by its iso code via the `GetLanguageByIsoCode` method: ```csharp // Get a reference to the language by its ISO code @@ -18,9 +22,9 @@ ILanguage language2 = _localizationService.GetLanguageByIsoCode("en-US"); The ISO code is a combination of the two-letter ISO 639-1 language code (lowercase) and two-letter ISO-3166 country code (uppercase). Eg. `en-US` for English in the United States, `en-GB` for English in the United Kingdom and `da-DK` for Danish in Denmark. -Both methods will return an instance of the [ILanguage](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Models.ILanguage.html) interface, which has traditional properties like `Id` and `Key`, but also properties specific to the language like `CultureName`, `CultureInfo` and `IsoCode`. You can see the API reference for further information on the properties of the interface. +Both methods will return an instance of the [ILanguage](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Models.ILanguage.html) interface, which has traditional properties like `Id` and `Key`, but also properties specific to the language like `CultureName`, `CultureInfo` and `IsoCode`. You can see the API reference for further information on the properties of the interface. -### Getting all languages +## Getting all languages If you need instead need a list of all installed languages, you can use the `GetAllLanguages` method. It takes no parameters, and as such a returns a collection of all languages (with no pagination like some of the other services): diff --git a/14/umbraco-cms/reference/management/services/userservice/README.md b/14/umbraco-cms/reference/management/services/userservice/README.md deleted file mode 100644 index c9658a36de6..00000000000 --- a/14/umbraco-cms/reference/management/services/userservice/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# UserService - -The UserService acts as a "gateway" to Umbraco data for operations which are related to Users. - - * **Namespace:** `Umbraco.Core.Services` - * **Assembly:** `Umbraco.Core.dll` - -All samples listed in this document will require references to the following dll: - -* Umbraco.Core.dll - -All samples in this document will require the following using statements: - -```csharp -using Umbraco.Core; -using Umbraco.Core.Models; -using Umbraco.Core.Services; -``` - -## Getting the service - -### Services property - -If you wish to use the UserService in a class that inherits from one of the Umbraco base classes (eg. `SurfaceController`, `UmbracoApiController` or `UmbracoAuthorizedApiController`), you can access the service through a local `Services` property: - -```csharp -IUserService userService = Services.UserService; -``` - -### Dependency Injection - -In other cases, you may be able to use Dependency Injection. For instance if you have registered your own class in Umbraco's dependency injection, you can specify the `IUserService` interface in your constructor: - -```csharp -public class MyClass -{ - - private IUserService _userService; - - public MyClass(IUserService userService) - { - _userService = userService; - } - -} -``` - -### Static accessor - -If neither a `Services` property or Dependency Injection is available, you can also reference the static `Current` class directly: - -```csharp -IUserService userService = Umbraco.Core.Composing.Current.Services.UserService; -``` - - -## Samples - -* [**Create a new user**](create-a-new-user.md)
Quick sample showing how to create a new backoffice user; including setting a password, assigning the user to a user group, and setting the name of the user. From db078a56b7352501fe6fbf4e4b2d49603159cedf Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:08:29 +0100 Subject: [PATCH 03/16] Update 14/umbraco-cms/reference/management/services/retrieving-content-types.md --- .../reference/management/services/retrieving-content-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/retrieving-content-types.md b/14/umbraco-cms/reference/management/services/retrieving-content-types.md index 956593c2f6a..4e74dd073fd 100644 --- a/14/umbraco-cms/reference/management/services/retrieving-content-types.md +++ b/14/umbraco-cms/reference/management/services/retrieving-content-types.md @@ -85,7 +85,7 @@ bool hasChildren = _contentTypeService.HasChildren(1234); ## Getting a single content type container -Content types can be added either at the root level, under another content type or under a content type container (or folders as they're called in the Umbraco backoffice). The approach for getting a single container is similar to getting a single content type, meaning that you can look up a container - either by its GUID: +Content types can be added either at the root level, under another content type or under a content type container (container is a folder). The approach for getting a single container is similar to getting a single content type. This means that you can look up a container - either by its GUID: ```csharp // Declare the GUID ID From 5d25cfb9ea31fd25869cc57b5edd017442100360 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:09:48 +0100 Subject: [PATCH 04/16] Update 14/umbraco-cms/reference/management/services/README.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- 14/umbraco-cms/reference/management/services/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index 76d4b59fe58..b265d20e152 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -1,5 +1,5 @@ --- -description: List of services references, how to use them and some examples. +description: List of service references along with instructions on how to use them, as well as some examples for better understanding. --- # Services References From 80651321e0a3bd80d9498256ae6d11f54584f44f Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:09:55 +0100 Subject: [PATCH 05/16] Update 14/umbraco-cms/reference/management/services/README.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- 14/umbraco-cms/reference/management/services/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index b265d20e152..b23800a1d88 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -2,7 +2,7 @@ description: List of service references along with instructions on how to use them, as well as some examples for better understanding. --- -# Services References +# Service References Below you can find a list of most common services: From a3bc450a1bebfd3a45401274cfab59af7dec8bf7 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:10:28 +0100 Subject: [PATCH 06/16] Update 14/umbraco-cms/reference/management/services/README.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- 14/umbraco-cms/reference/management/services/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index b23800a1d88..7e11554157a 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -62,7 +62,7 @@ All services can be accessed with the following using statement: using Umbraco.Cms.Core.Services; ``` -In other cases, you may be able to use [Dependency Injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection). For instance if you have registered your own class in Umbraco's dependency injection, you can specify the service interface in your constructor. +In some cases, you can use [Dependency Injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection). For example, if you have registered your class in Umbraco's dependency injection, you can specify the service interface in your constructor. For example, if you use a `NotificationService` you can use Dependency Injection via the `INotificationService` interface like this: From b0971421cfee042bf2189e00286a38ed76780adc Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:10:35 +0100 Subject: [PATCH 07/16] Update 14/umbraco-cms/reference/management/services/create-a-new-user.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- .../reference/management/services/create-a-new-user.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/create-a-new-user.md b/14/umbraco-cms/reference/management/services/create-a-new-user.md index 46f83fad6bf..e00ba317993 100644 --- a/14/umbraco-cms/reference/management/services/create-a-new-user.md +++ b/14/umbraco-cms/reference/management/services/create-a-new-user.md @@ -6,7 +6,7 @@ description: This will show you how to add a user to a user group using the User ## Services property -If you wish to use the UserService in a class that inherits from one of the Umbraco base classes (eg. `SurfaceController`, `UmbracoApiController` or `UmbracoAuthorizedApiController`), you can access the service through a local `Services` property: +If you wish to use the UserService in a class that inherits from one of the Umbraco base classes (For example: `SurfaceController`, `UmbracoApiController`, or `UmbracoAuthorizedApiController`), you can access the service through a local `Services` property: ```csharp IUserService userService = Services.UserService; From b3f5f5959cc824ffe0f6e28b57d6bbe4961e1037 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:10:45 +0100 Subject: [PATCH 08/16] Update 14/umbraco-cms/reference/management/services/create-a-new-user.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- .../reference/management/services/create-a-new-user.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/create-a-new-user.md b/14/umbraco-cms/reference/management/services/create-a-new-user.md index e00ba317993..c9d18d61fff 100644 --- a/14/umbraco-cms/reference/management/services/create-a-new-user.md +++ b/14/umbraco-cms/reference/management/services/create-a-new-user.md @@ -14,7 +14,7 @@ IUserService userService = Services.UserService; ## Static accessor -If neither a `Services` property or Dependency Injection is available, you can also reference the static `Current` class directly: +If neither a `Services` property nor Dependency Injection is available, you can reference the static `Current` class directly: ```csharp IUserService userService = Umbraco.Core.Composing.Current.Services.UserService; From 90b04ecc4b4b1e4468e7dc1df2a3df3f8429d57b Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:10:52 +0100 Subject: [PATCH 09/16] Update 14/umbraco-cms/reference/management/services/relationservice.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- 14/umbraco-cms/reference/management/services/relationservice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/relationservice.md b/14/umbraco-cms/reference/management/services/relationservice.md index 7c8ca5b6f57..2207e5ccaaa 100644 --- a/14/umbraco-cms/reference/management/services/relationservice.md +++ b/14/umbraco-cms/reference/management/services/relationservice.md @@ -4,7 +4,7 @@ The `RelationService` allows you to create relations between objects that would # Examples -Below you will examples using the `RelationService`. +Below you will find examples using `RelationService`. ## Automatically relate to root node From 657c83b81846bdf44c9055243286e40fcc37e5e3 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:11:09 +0100 Subject: [PATCH 10/16] Update 14/umbraco-cms/reference/management/services/retrieving-content-types.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- .../reference/management/services/retrieving-content-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/retrieving-content-types.md b/14/umbraco-cms/reference/management/services/retrieving-content-types.md index 4e74dd073fd..124161d426f 100644 --- a/14/umbraco-cms/reference/management/services/retrieving-content-types.md +++ b/14/umbraco-cms/reference/management/services/retrieving-content-types.md @@ -85,7 +85,7 @@ bool hasChildren = _contentTypeService.HasChildren(1234); ## Getting a single content type container -Content types can be added either at the root level, under another content type or under a content type container (container is a folder). The approach for getting a single container is similar to getting a single content type. This means that you can look up a container - either by its GUID: +You can add content types in three different ways - at the root level, under another content type, or under a container (which is essentially a folder). To obtain a single container, the process is similar to obtaining a single content type. This means that you can search for a container either by its GUID: ```csharp // Declare the GUID ID From 1c971310d8e6043e79c6151f004bf97be87c5ed2 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:11:14 +0100 Subject: [PATCH 11/16] Update 14/umbraco-cms/reference/management/services/retrieving-languages.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- .../reference/management/services/retrieving-languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/retrieving-languages.md b/14/umbraco-cms/reference/management/services/retrieving-languages.md index 4e31f47d66e..d05774b4c3b 100644 --- a/14/umbraco-cms/reference/management/services/retrieving-languages.md +++ b/14/umbraco-cms/reference/management/services/retrieving-languages.md @@ -13,7 +13,7 @@ The localization service contains a number of methods for looking up languages. ILanguage language1 = _localizationService.GetLanguageById(1); ``` -As an alternative, you can look up a language by its iso code via the `GetLanguageByIsoCode` method: +As an alternative, you can look up a language by its ISO code via the `GetLanguageByIsoCode` method: ```csharp // Get a reference to the language by its ISO code From 1df4e5741c9ffeba4619da77bf37acbde221ed88 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:11:44 +0100 Subject: [PATCH 12/16] Update 14/umbraco-cms/reference/management/services/README.md Co-authored-by: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> --- 14/umbraco-cms/reference/management/services/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index 7e11554157a..1e587a79980 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -84,9 +84,7 @@ In Razor views, you can access the Notification Service through the `@inject` di @inject INotificationService NotificationService ``` -{% hint style="info" %} -The same example can be used for the other service where you can replace the interface and service name. -{% endhint %} +You can use the above example for other services where you can replace the interface and service name. # Samples From 15fca8b19c2fc86e32b938df0f86864a4d8eba23 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:14:48 +0100 Subject: [PATCH 13/16] Update 14/umbraco-cms/reference/management/services/README.md --- 14/umbraco-cms/reference/management/services/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index 1e587a79980..3c3f3713e17 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -42,7 +42,7 @@ Below you can find a list of most common services: ## [TagService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ITagService.html) -## [TextService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ILocalizedTextService.html) +## [LocalizedTextService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.LocalizedTextService.html) ## [ContentService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentService.html) From 88bd162da15f4ba2d9381cdee6c26afb1271bebd Mon Sep 17 00:00:00 2001 From: "Alina-Magdalena Tincas (Umbraco HQ)" Date: Wed, 27 Mar 2024 15:17:05 +0100 Subject: [PATCH 14/16] alphabetize list of services --- .../reference/management/services/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/14/umbraco-cms/reference/management/services/README.md b/14/umbraco-cms/reference/management/services/README.md index 3c3f3713e17..5917690dae1 100644 --- a/14/umbraco-cms/reference/management/services/README.md +++ b/14/umbraco-cms/reference/management/services/README.md @@ -10,6 +10,10 @@ Below you can find a list of most common services: ## [ConsentService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IConsentService.html) +## [ContentService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentService.html) + +## [ContentTypeService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentTypeService.html) + ## [DataTypeService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IDataTypeService.html) ## [DomainService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IDomainService.html) @@ -20,6 +24,10 @@ Below you can find a list of most common services: ## [FileService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IFileService.html) +## [LocalizationService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ILocalizationService.html) + +## [LocalizedTextService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.LocalizedTextService.html) + ## [MediaService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IMediaService.html) ## [MemberGroupService](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMemberGroupService.html) @@ -42,14 +50,6 @@ Below you can find a list of most common services: ## [TagService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ITagService.html) -## [LocalizedTextService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.LocalizedTextService.html) - -## [ContentService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentService.html) - -## [ContentTypeService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IContentTypeService.html) - -## [LocalizationService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ILocalizationService.html) - ## [UserService](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.IUserService.html) You can find a list of all supported services in the [API Docs](https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.html). From 53d459f9b27406e4743504b3b5824fc5653bfab6 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:21:24 +0100 Subject: [PATCH 15/16] Update 14/umbraco-cms/reference/management/services/create-a-new-user.md --- .../reference/management/services/create-a-new-user.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/create-a-new-user.md b/14/umbraco-cms/reference/management/services/create-a-new-user.md index c9d18d61fff..659d9e7837d 100644 --- a/14/umbraco-cms/reference/management/services/create-a-new-user.md +++ b/14/umbraco-cms/reference/management/services/create-a-new-user.md @@ -6,7 +6,7 @@ description: This will show you how to add a user to a user group using the User ## Services property -If you wish to use the UserService in a class that inherits from one of the Umbraco base classes (For example: `SurfaceController`, `UmbracoApiController`, or `UmbracoAuthorizedApiController`), you can access the service through a local `Services` property: +If you wish to use the UserService in a class that inherits from one of the Umbraco base classes. For example: `SurfaceController`, `UmbracoApiController`, or `UmbracoAuthorizedApiController`). You can access the service through a local `Services` property: ```csharp IUserService userService = Services.UserService; From cb05e1a2d7800c5488a60e3c935d429043c62fc7 Mon Sep 17 00:00:00 2001 From: Alina-Magdalena Tincas <83591955+alina-tincas@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:34:45 +0100 Subject: [PATCH 16/16] Update 14/umbraco-cms/reference/management/services/retrieving-content-types.md --- .../reference/management/services/retrieving-content-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/reference/management/services/retrieving-content-types.md b/14/umbraco-cms/reference/management/services/retrieving-content-types.md index 124161d426f..ff0887f6d99 100644 --- a/14/umbraco-cms/reference/management/services/retrieving-content-types.md +++ b/14/umbraco-cms/reference/management/services/retrieving-content-types.md @@ -85,7 +85,7 @@ bool hasChildren = _contentTypeService.HasChildren(1234); ## Getting a single content type container -You can add content types in three different ways - at the root level, under another content type, or under a container (which is essentially a folder). To obtain a single container, the process is similar to obtaining a single content type. This means that you can search for a container either by its GUID: +You can add content types in three different ways. At the root level, under another content type, or under a _container_ (which is a folder). To obtain a single container, the process is similar to obtaining a single content type. This means that you can search for a container either by its GUID: ```csharp // Declare the GUID ID