Sitecoredada helps to improve technical skills in Different Technologies like Sitecore, .Net,React
Sunday, January 14, 2018
Thursday, January 11, 2018
Sitecore Indexing Automation
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Maintenance;
// add Sitecore.ContentSearch dll in your solution to use above two namespaces
public void Indexing()
{
try
{
IndexCustodian.FullRebuild(ContentSearchManager.GetIndex("Your_Index_Name"), true);
}
catch (Exception ex)
{
throw ex;
}
}
Sitecore Publish Automation
using Sitecore.Publishing;
using Sitecore.Data;
public void Publishing()
{
try
{
string rootItemPath = "/sitecore/Content/foldername/";
Database sourceDb = Sitecore.Configuration.Factory.GetDatabase("master");
Database targeteDb = Sitecore.Configuration.Factory.GetDatabase("web");
var language = Sitecore.Context.Language;
var contentItem = sourceDb.GetItem(rootItemPath);
PublishOptions options = new PublishOptions(sourceDb, targeteDb, PublishMode.Smart, language, DateTime.Now)
{
RootItem = contentItem,
PublishRelatedItems = true,
Deep = true
};
//If publish mode is FULL then CompareRevisions should be false
//options.CompareRevisions = false;
Publisher publisher = new Publisher(options);
bool willBeQueued = publisher.WillBeQueued;
publisher.PublishAsync();
publisher.Publish();
}
catch (Exception ex)
{
throw ex;
}
}
using Sitecore.Data;
public void Publishing()
{
try
{
string rootItemPath = "/sitecore/Content/foldername/";
Database sourceDb = Sitecore.Configuration.Factory.GetDatabase("master");
Database targeteDb = Sitecore.Configuration.Factory.GetDatabase("web");
var language = Sitecore.Context.Language;
var contentItem = sourceDb.GetItem(rootItemPath);
PublishOptions options = new PublishOptions(sourceDb, targeteDb, PublishMode.Smart, language, DateTime.Now)
{
RootItem = contentItem,
PublishRelatedItems = true,
Deep = true
};
//If publish mode is FULL then CompareRevisions should be false
//options.CompareRevisions = false;
Publisher publisher = new Publisher(options);
bool willBeQueued = publisher.WillBeQueued;
publisher.PublishAsync();
publisher.Publish();
}
catch (Exception ex)
{
throw ex;
}
}
Adding the Custom Css classes in Rich Text Editor under the Apply Css Classes dropdown
Adding the Custom Css classes in Rich text Editor need to be done in below two steps.
1) Add the your custom css file in under the Inetpub/wwwroot/[Your website]/YourCssFile.css
2) Add this file path in Sitecore.config under the [Yourwebsite]/Appconfig/Sitecore.config
after the default.css setting like below
<setting name="WebStyleSheet" value="/default.css"/>
<setting name="WebStyleSheet" value="/YourCssFile.css"/>
Classes under YourCSSFile.css:
Check Your Classes are coming on the Rich Text Editor Full under the Apply Css Class Dropdown.
If you unable to see the your classes in Apply Css class dropdown in Rich text editor Full:
Add your classes in the Tools.xml file in Sitecore in below path
C:\inetpub\wwwroot\[Your Site folder]\Website\sitecore\shell\Controls\Rich Text Editor
under the <classes></classes> in Tools.xml File as below
RTE:
1) Add the your custom css file in under the Inetpub/wwwroot/[Your website]/YourCssFile.css
2) Add this file path in Sitecore.config under the [Yourwebsite]/Appconfig/Sitecore.config
after the default.css setting like below
<setting name="WebStyleSheet" value="/default.css"/>
<setting name="WebStyleSheet" value="/YourCssFile.css"/>
Classes under YourCSSFile.css:
Check Your Classes are coming on the Rich Text Editor Full under the Apply Css Class Dropdown.
If you unable to see the your classes in Apply Css class dropdown in Rich text editor Full:
Add your classes in the Tools.xml file in Sitecore in below path
C:\inetpub\wwwroot\[Your Site folder]\Website\sitecore\shell\Controls\Rich Text Editor
under the <classes></classes> in Tools.xml File as below
RTE:
Wednesday, January 10, 2018
Friday, January 5, 2018
Resolving Fast Query Error:"End Of string expected at position 5"
Writing a fast Query in Sitecore pretty simple.
Fast query will helpful to get the Immediate Children and Grand Children as well.
sitecore query only get the immediate children.
It is easy to write the queries with Xpath Builder.you can access the Xpath Builder at
http://[Your Domain]/sitecore/shell/default.aspx?xmlcontrol=IDE.XPath.Builder in Sitecore 8+ versions.
sometimes the fast query will work in Xpath Builder perfectly. but it will not work in real Template fields like droplist,multilist,Treelist fields.
error:"End of string expected at position 5"
if you get the above error:
if you get the above error:
1) Make Sure if you have any Spaces in the fast query,enclosed with '#'
fast:/sitecore/content/#Hello world#/Articles//*[@@templatename='One Column']
2) Make sure you wrote the Query with "query:fast:" whenever passing some conditions like get Only Specific Items based on the Template Id or Template Name syntax as below
query:fast:/sitecore/content/#Hello world#/Articles//*[@@templatename='One Column']
Thursday, January 4, 2018
Previewing the Secure Page in Sitecore
Previewing the Secure Page in Sitecore
PREVIEW AS ANONYMOUS
<setting name="Preview. AsAnonymous" value="true" />
The above setting specifies whether Sitecore will use the Anonymous user account when you preview an item.
If true, Sitecore uses the Anonymous user account when you preview an item.
If false, Sitecore uses the current user account when you preview an item.
Default value: true
The above setting and and information provided by sitecore you will find in AppConfig\Sitecore.config file.
Subscribe to:
Posts (Atom)