# Publish-Item

Publishes a Sitecore item.

## Syntax

Publish-Item \[-Item] \<Item> \[-Recurse] \[-Target \<String\[]>] \[-PublishMode \<Unknown | Full | Incremental | SingleItem | Smart>] \[-PublishRelatedItems] \[-RepublishAll] \[-CompareRevisions] \[-FromDate \<DateTime>] \[-AsJob] \[-Language \<String\[]>]

Publish-Item \[-Path] \<String> \[-Recurse] \[-Target \<String\[]>] \[-PublishMode \<Unknown | Full | Incremental | SingleItem | Smart>] \[-PublishRelatedItems] \[-RepublishAll] \[-CompareRevisions] \[-FromDate \<DateTime>] \[-AsJob] \[-Language \<String\[]>]

Publish-Item -Id \<String> \[-Database \<String>] \[-Recurse] \[-Target \<String\[]>] \[-PublishMode \<Unknown | Full | Incremental | SingleItem | Smart>] \[-PublishRelatedItems] \[-RepublishAll] \[-CompareRevisions] \[-FromDate \<DateTime>] \[-AsJob] \[-Language \<String\[]>]

## Detailed Description

The Publish-Item command publishes the Sitecore item and optionally subitems. Allowing for granular control over languages and modes of publishing.

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

## Parameters

### -Recurse \<SwitchParameter>

Specifies that subitems should also get published with the root item.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Target \<String\[]>

Specifies one or many publishing targets. The default target database is "web".

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -PublishMode \<PublishMode>

Specified the Publish mode. Valid values are:

* Full
* Incremental
* SingleItem
* Smart

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -PublishRelatedItems \<SwitchParameter>

Turns publishing of related items on. Works only on Sitecore 7.2 or newer

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -RepublishAll \<SwitchParameter>

Republishes all items provided to the publishing job.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -CompareRevisions \<SwitchParameter>

Turns revision comparison on.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -FromDate \<DateTime>

Publishes items newer than the date provided only.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -AsJob \<SwitchParameter>

The Sitecore API called to perform the publish is different with this switch. You may find that events fire as expected using this.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Language \<String\[]>

Language of the item that should be published. Supports globbing/wildcards. Allows for more than one language to be provided at once. e.g. "en\*", "pl-pl"

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Item \<Item>

| Aliases                     |                                |
| --------------------------- | ------------------------------ |
| Required?                   | true                           |
| Position?                   | 1                              |
| Default Value               |                                |
| Accept Pipeline Input?      | true (ByValue, ByPropertyName) |
| Accept Wildcard Characters? | false                          |

### -Path \<String>

Path to the item that should be published - can work with Language parameter to narrow the publication scope.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | 1     |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Id \<String>

Id of the item that should be published - can work with Language parameter to narrow the publication scope.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Database \<String>

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

## Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

* Sitecore.Data.Items.Item

## Outputs

The output type is the type of the objects that the cmdlet emits.

* None.

## Notes

Help Author: Michael West, Adam Najmanowicz

## Examples

### EXAMPLE 1

```powershell
PS master:\> Publish-Item -Path master:\content\home -Target Internet
```

### EXAMPLE 2

```powershell
PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -PublishMode Incremental
```

### EXAMPLE 3

```powershell
PS master:\> Get-Item -Path master:\content\home | Publish-Item -Recurse -Language "en*"
```

### EXAMPLE 4

Publish to many databases

```
PS master:\> $targets = [string[]]@('web','internet')
PS master:\> Publish-Item -Path master:\content\home -Target $targets
```

## Related Topics

* <https://github.com/SitecorePowerShell/Console/>


---

# Agent Instructions: 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:

```
GET https://doc.sitecorepowershell.com/appendix/common/publish-item.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
