Here are a few pointers that will help to troubleshoot.
- Verify that your item is in the
final workflow state
, if a workflow is specified. If no workflow is specific, then workflow state should be empty.
- Verify that your item is
publishable
, or if a particular version is not getting published, make sure the version is publishable.
- Make sure your
publishing targets
are set correctly. By default, no publishing targets should be selected, which means Sitecore will deploy to all publishing targets. View the raw value of the Publishing Targets field, as sometimes an old, non-existing publishing target is specified and the UI will not show it. If there are any values specified for Publishing Targets, the best way to clear it is to reset the field.
- Make sure your publishing targets are setup correctly. Typically we have one publishing target named Internet and the target database is
web
.
- Make sure your
item name is valid
. Sometimes we update the invalid characters list after items have been created.
- Make sure none of the parent items fail to publish.
Once you have verified all of these, you should be able to publish the item and it should show in the web database. If your item is in the web database and you are still unable to access the item via the web, check these items:
- Make sure your item name is valid. Sometimes we update the invalid characters list after items have been created and published. Item names with hyphens in particular usually cause issues.
- Make sure there aren’t any Sitecore Aliases are interfering (see /sitecore/system/Aliases).
https://blog.martinmiles.net/post/item-not-published-troubleshooting
Also if your code is executed with no error then update the Publishing.CheckSecurity
to true
and validate your code with below.
<setting name="Publishing.CheckSecurity">
<patch:attribute name="value">true</patch:attribute>
</setting>
private void PublishItem(Sitecore.Data.Items.Item item)
{
using (new SecurityDisabler())
{
Sitecore.Publishing.PublishOptions publishOptions =
new Sitecore.Publishing.PublishOptions(item.Database,
Database.GetDatabase("web"),
Sitecore.Publishing.PublishMode.SingleItem,
item.Language,
System.DateTime.Now); // Create a publisher with the publishoptions
Sitecore.Publishing.Publisher publisher = new Sitecore.Publishing.Publisher(publishOptions);
publisher.Options.RootItem = item;
publisher.Options.Deep = true;
publisher.PublishAsync();
}
}
https://sitecoreinfo.blogspot.com/2019/02/sitecore-publish-programmatically-not.html
Hope it helps!