> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-cms/13.latest/reference/notifications/sendingallowedchildrennotifications.md).

# Sending Allowed Children Notification

The `SendingAllowedChildrenNotification` enables you to manipulate the Document Types that will be shown in the create menu when adding new content in the backoffice.

## Usage

With the example below we can ensure that a Document Type cannot be selected if the type already exists in the Content tree.

```csharp
using System.Web;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;

namespace Umbraco.Docs.Samples.Web.Notifications;

public class SendingAllowedChildrenNotificationHandler : INotificationHandler<SendingAllowedChildrenNotification>
{
    public void Handle(SendingAllowedChildrenNotification notification)
    {
        const string contentIdKey = "contentId";

            // Try get the id from the content item in the backoffice
            var queryStringCollection = HttpUtility.ParseQueryString(notification.UmbracoContext.OriginalRequestUrl.Query);

        if (!queryStringCollection.ContainsKey(contentIdKey))
        {
            return;
        }

        var contentId = queryStringCollection[contentIdKey].TryConvertTo<int>().ResultOr(-1);

        if (contentId == -1)
        {
            return;
        }

        var content = notification.UmbracoContext.Content?.GetById(true, contentId);

        if (content is null)
        {
            return;
        }

        // Allowed children as configured in the backoffice
        var allowedChildren = notification.Children.ToList();

        if (content.ChildrenForAllCultures is not null)
        {
            // Get all children of current page
            var childNodes = content.ChildrenForAllCultures.ToList();

            // If there is a Settings page already created, then don't allow it anymore
            // You can also use the ModelTypeAlias property from your PublishedModel for comparison,
            // like Settings.ModelTypeAlias if you have set models builder to generate SourceCode models
            if (childNodes.Any(x => x.ContentType.Alias == "settings"))
            {
                allowedChildren.RemoveAll(x => x.Alias == "settings");
            }
        }

        // Update the allowed children
        notification.Children = allowedChildren;
    }
}
```

You also need to register this notification handler. You can achieve this by updating the `Program` class like:

```csharp
builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .AddNotificationHandler<SendingAllowedChildrenNotification, SendingAllowedChildrenNotificationHandler>()
    .Build();
```

{% hint style="info" %}
For more information about registering notifications read the [Registering notification handlers](/umbraco-cms/13.latest/reference/notifications.md) article.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-cms/13.latest/reference/notifications/sendingallowedchildrennotifications.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
