Posts

Showing posts with the label Sitecore Extensions

Running SQL Queries On Sitecore Databases Using Sitecore PowerShell Extensions

Image
  Whether you are developing on Sitecore or supporting a live Sitecore instance, there are times you need to access the SQL databases to run queries to fetch some data. While the Sitecore APIs provide access to the items in the content tree, they are not very useful when you want to check the old login tickets in core database, or need to inspect the JWT tokens received from identity provider when using federated authentication.  There are many reasons for a Sitecore developer to want to access the Sitecore database. I am sure there are equal if not more number of reasons for the security team to deny access. Many a times you would be an admin on the Sitecore instance but won't even have read-only access to the SQL databases. In this article I am going to show how you can run simple queries on the Sitecore databases using the power of SPE. For this to work, you need to have access to use the PowerShell ISE on the Sitecore instance. First, we will need to fetch the connection s...

Sitecore OData Item Api extensions for reference type fields

 Sitecore OData Item Api provides readonly access to Sitecore items. The OData Item Api is particularly useful when you need to pull some data from Sitecore to show on a non-Sitecore websites. In my case, I needed to pull a list of current job opening in my organization to show them on our company's non-Sitecore website's careers page. For more information on OData Item Api and how to query the data, check the Sitecore documentation page . One thing that particularly bothered me when using OData Item Api service to get an item and its field values using a query like below is, the lack of support for getting the link field target URL in one query. /sitecore/api/ssc/aggregate/content/Items('{F7SDEBB9-6AB1-4ACC-A790-FE627DD18722}')?$expand=FieldValues&sc_apikey={ADGT918E-8F0F-4F7E-8C77-DEE3F4F2E1Y1} When you run the above query against an item with General link field, the output for the field values looks something like this As you can see, the link field value is just...