Accessing Current Context Item in Sitecore Powershell Script

I was looking for a way to access context item in a SPE script that will be invoked upon a ribbon button click which I couldn’t find in any documentation. And I figured that in SPE scripts, we have a special variable called ‘$SitecoreContextItem’ that holds information about the context item. I hope this tip is useful to someone.

$contextItem = $SitecoreContextItem

Leave a Reply

Your email address will not be published. Required fields are marked *