Download Files from Media Library using Sitecore PowerShell Extension

SPE is a powerful tool. You can do a lot with it. So, whenever I think something needs a lot of manual intervention and can be automated I look into SPE.

So, here I am, trying to download a bunch of files from one Sitecore instance and bring it over for reorganization, renaming and reused.

SPW, has GET-ITEM and SEND-ITEM. So I jump in.

Get-Item -Path "master:" -Query "/sitecore/media library/Images/Habitat/" | Send-File -NoDialog

But, it was only downloading one file. What the cinnamon toast crunch am I missing?

So, I went deeper and dumber and used a script that does Get-Item on the root, Foreach thru all the items, then run Send-File one at a time. No Dice. It only ran once then Sitecore hung.

After a bunch of trials and errors I ditched “-NoDialog” and a heavenly dialog showed up.

Clicked on Download, It downloaded the file. Clicked on Close and another dialog showed up for the next file. And then do this for 346 more time. I think not.

MichaellWest jumped in saying “I believe I have seen that issue before. Can’t seem to find it on github though.”

So, for those in the same boat as me. Please use this instead.

Right click on the Item, Scripts > Download. This works wonder. You will get all your raw files in a zip file.

Still SPE but not scripted.

~ Scratching is as irresistible as Cocain. ~

New to Sitecore? Boss wants you to create something new. Read this and stop crying…

Wipe those tears off. Turn on your computer. Make sure your mouse and keyboard are plugged in and vaguely follow these steps below…

  • Find out the name of your new component, items, field, sections, etc…
  • Gather all requirements
  • THE SITECORE PART
    • Creating the template
      • Create the folder template (if needed), this is where the main item template will go in), comes in handy for organization and insert options.
      • Create the item template
        • Create the fields
          • Name the sections properly
          • Pick proper field type
        • Create standard values
          • Go to Options Tab > click on standard values
      • Create icons, insert options, validation rules, display names, etc
      • Create a template for the folder which will hold the above templates
        • set insert options for the above template
    • The Layout
      • Create Rendering
        • usually a controller rendering, View renderings are very common as well
        • Give the appropriate controller and action name
        • maybe even a Datasource Template
        • Thumbnails are useful for authors
      • Go back to the template
        • on standard values
          • set the presentation > detail
          • find the layout name
          • find the right placeholder name
            • look in layout.cshtml if needed
    • Layout > Placeholder settings
      • add the new template to allowed rendering
    • Content
      • Create a structure
      • create content
  • THE CODE PART
    • create controller
    • create Model
    • Create View
  • Deploy
    • build ( gulp is widely used)
  • Test
  • Check-in
    • Don’t forget the TDS items
  • Pull Request
  • Review
  • Enjoy Life!!!

Will add screenshots soon… until then you are on your own. Figure it out like the rest of us πŸ˜›

 

 

~ How many is a few? ~

 

Sitecore SXA and the PowerShell extension

Recently I had a project where I upgraded Sitecore 822 to Sitecore 901 with SXA.

It was a long and staggering process but was completed.

One of the many tricks I learned there is

You can use Powershell 4.7.2 (the latest version) for all the legacy SXA versions. I have tested it as far back as SXA 1.2. even though the table says otherwise.

From: https://kb.sitecore.net/articles/180187

Compatibility With Sitecore PowerShell Extensions

SXA Sitecore PowerShell Extensions
4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.7.2
SXA 1.0 βœ“[2] βœ“[2] βœ“[2] βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
SXA 1.1 βœ“[2] βœ“[2] βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
SXA 1.2 βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
SXA 1.3 βœ“ βœ“ βœ“ βœ“
SXA 1.3.1 βœ“ βœ“ βœ“ βœ“
SXA 1.4 βœ“ βœ“ βœ“
SXA 1.5 βœ“ βœ“
SXA 1.6 βœ“
SXA 1.7 βœ“
SXA 1.7.1 βœ“

Legend:Β “-” – not supported; “βœ“” – supported.

 

~ Wait, there is more. ~