You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two problems I can see with the Publish-Item cmdlet
The recurse param doesn’t seem to work
There is no audit log of the publish
Diagnosis:
If you amend the following line : PublishItemPipeline.Run(item.ID, options);
to return a PublishItemResult object, you can then interrogate this to find the outcome of the PublishOperation (e.g. None, Skipped, Created, Updated, Deleted).
This is good because it gives some more verbose feedback, and you can see scenarios where publishing will be skipped (e.g. due to its workflow being unable to publish or publishing restrictions). However, despite the Deep argument being set, I was unable to get any scenario working where child items are published, even if you explicitly set RootItem in the PublishOptions object. Furthermore, there is no audit log of the publish so I was unable to tell truly how many items were being published. Nor, does running the cmdlet seem to trigger the publish events listed here: http://sdn.sitecore.net/articles/api/using%20events.aspx (which I proved by wiring up publish:begin to the powershell event interceptor - very nice feature by the way).
So I started to assume the wrong API call is being made. I isolated the code in Sitecore.Kernel which I think manages both audit logging AND recursive behaviour in publish operations and it can be found in PublishManager. I’m not sure if it’s correct to invoke this rather than PublishItemPipeline (people with more Sitecore experience could advise). However, I've made this change locally and tested it and now not only do I see audit logs with the publish count but I also have child items being published.
I'll issued a pull request with my change.
The text was updated successfully, but these errors were encountered:
I'm having trouble getting the -RepublishAll to work. It's not recognized as a parameter. My PSVersion is 4.0. Any ideas? I've used both the -Item and the -Path parameters to no avail.
There are two problems I can see with the Publish-Item cmdlet
Diagnosis:
If you amend the following line :
PublishItemPipeline.Run(item.ID, options);
to return a
PublishItemResult
object, you can then interrogate this to find the outcome of the PublishOperation (e.g. None, Skipped, Created, Updated, Deleted).This is good because it gives some more verbose feedback, and you can see scenarios where publishing will be skipped (e.g. due to its workflow being unable to publish or publishing restrictions). However, despite the Deep argument being set, I was unable to get any scenario working where child items are published, even if you explicitly set
RootItem
in thePublishOptions
object. Furthermore, there is no audit log of the publish so I was unable to tell truly how many items were being published. Nor, does running the cmdlet seem to trigger the publish events listed here: http://sdn.sitecore.net/articles/api/using%20events.aspx (which I proved by wiring up publish:begin to the powershell event interceptor - very nice feature by the way).So I started to assume the wrong API call is being made. I isolated the code in Sitecore.Kernel which I think manages both audit logging AND recursive behaviour in publish operations and it can be found in
PublishManager
. I’m not sure if it’s correct to invoke this rather thanPublishItemPipeline
(people with more Sitecore experience could advise). However, I've made this change locally and tested it and now not only do I see audit logs with the publish count but I also have child items being published.I'll issued a pull request with my change.
The text was updated successfully, but these errors were encountered: