Wednesday, December 15, 2021

Sitecore Eliminate Bucket Folder Item Names from Page Item URLs

 Hi Folkes,

Recently we have requirement where we have to remove the unnecessary folder created in bucket items while accessing underneath bucketable items, so I just search for that and I found few blogs very useful here mentioned below:

https://sitecorejunkie.com/2016/05/31/omit-sitecore-bucket-folder-item-names-from-page-item-urls/

http://www.debugthecode.com/p/blog-page_15.html

I personally follow below blog:

http://www.debugthecode.com/p/blog-page_15.html

But I found one challenge Above article using LinkProvider which is obsolete in Sitecore 10 so I decided to search more what we can use instead of LinkProvider and I found below article useful where explained how can we use ItemUrlBuilder in place of LinkProvider:

https://www.konabos.com/blog/sitecore-linkprovider-is-now-obsolete

You can follow this below repo to implement the solution which support Sitecore 10 new ItemUrlBuilder instead link provider for remove the unnecessary folder from page item URL for bucketed items.

https://github.com/gaurarun777/Sitecore-Bucket-Folder-Item-Names-from-Page-Item-URL

I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)


Please leave your comments or share this article if it’s useful for you.

Friday, October 29, 2021

Sitecore TDS inegration issue solution

 

Hi Folkes,
 
Lots of Time we installed TDS and also that is completed successfully without any error like below:



But when we check in Visual Studio we found there's no TDS related project means not integrated with Visual studio correctly.

Recently I'm working on one application for that we need to install Sitecore TDS on VM. As we tried to install latest TDs version TDS 6.0.0.31 all the time not TDS installed successfully but we are unable to see TDS in our Visual Studio at the end we found this is because of Visual studio installer file is not installed properly in Visual Studio for that we just start investigating over internet and at the end I found, this is because of not appropriate access to the particular user As we also tried to install it manually by navigating to below path

“C:\Program Files (x86)\Sitecore\Sitecore TDS\HedgehogDevelopment.SitecoreProject.VSIP.vsix”

but unable to install on VM. Here below the error



During our part of this investigation, I found one blog it's very helpful for me mentioned below:

https://spiderinnet2.typepad.com/blog/2016/07/v.html

as for me “VSIXInstaller.exe” location changed (new path I am getting during manual installation error log ) so I used updated location and run the installation by using command line.

 

1.       Open CMD in admin mode.

2.       Then navigate to the respective directory where “VSIXInstaller.exe” present in my case location as below (which I got while I tried to installed it manually in error log):

“C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe

3.       The Run below command.

VSIXInstaller.exe "C:\Program Files (x86)\Sitecore\Sitecore TDS\HedgehogDevelopment.SitecoreProject.VSIP.vsix"

 

I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)


Please leave your comments or share this article if it’s useful for you.

Monday, September 27, 2021

Sitecore PowerShell Web API

Hi Folkes,

Few days back we got a requiremnet for access powershell script through browser. I went trough various articles and blogs but not found suffienct details for the same at a single place.

Today I will try to cover how can you setup Sitecore PowerShell Web API from scractch.
These below steps allow you to run powershell script though browser.

First make sure you have Sitecore PowerShell module install in your Sitecore.


  • At first open Sitecore PowerShell ISE
     
  • Click on New->New Module 
      


  • Give the Name of Module and check the 'Web API' checkbox like below:
     

  • After complete above step write custom script for referanc you can use below script:
  • if($length -eq $null){
    
    $length = 30
    
    }
    
    
    
    if($logType -eq $null){
    
    $logType = "log"
    
    }
    
    
    
    Get-ChildItem "$($SitecoreLogFolder)\$LogType*.*" |
    
    Sort-Object -Descending LastWriteTime |
    
    Select-Object -First 1 |
    
    
    
    Get-Content -Tail $length
    




  • Click on Save and save under LogFiles->WebAPI(recently created WebAPI module in 3rd step) in my case name is 'ShowLogs' like below:
         


  • Now you can access this script by entering below URL:
   
    



You also can able to pass parameter through query string as well for exapmle just add below 2 line in PowerShell Script:

write-host "Start Date Time: " $selectedStartDate
write-host "End Date Time: " $selectedEndDate

Now pass below URL:

http://{hostname}/-/script/v2/master/ShowLogs?selectedStartDate=06/23/2020&selectedEndDate=06/24/2020

Output will be like below:

    
Some more sample for parameter passing:
https://{hostname}/-/script/v2/master/ShowLogs
https://{hostname}/-/script/v2/master/ShowLogs?length=30
https://{hostname}/-/script/v2/master/ShowLogs?logType=Publishing
https://{hostname}/-/script/v2/master/ShowLogs?length=30&logType=Publishing


Even I just print the variable nothing else but you can do more customization by passing parameters.

In order for this to work. You need to enable restfulv2 in your Cognifide.PowerShell.config. which is located in Website\App_config\Include\Cognifide.PowerShell.config

<restfulv2 enabled=”true” requireSecureConnection=”false“>

I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)


Please leave your comments or share this article if it’s useful for you.