Tuesday, 30 June 2015

What is the Maximum Limit for Sitecore Item

The maximum length of an item name is configurable and by default it is set as 100.

      <!--  MAX ITEM NAME
            Specifies the maximum length of an item name.
            Default value: 100
      -->
      <setting name="MaxItemNameLength" value="100" />

Friday, 26 June 2015

Sitecore query analyzer in returning wrong Count

I was trying to get count of number of subitems within my ItemPath using below query select count(ItemPath/* ) but this query is returning always 500 though the number of items
select count(ItemPath/* ) but this query is returning always 500 though the number of items
Sitecore climber  suggest to check below properties 

   <!--  Query.MaxItems
            Specifies the max number of items in a query result set.
            If the number is 0, all items are returned. This may affect system performance, if a
            large query result is returned.
            This also controls the number of items in Lookup, Multilist and Valuelookup fields.
            Default value: 100
      -->
      <setting name="Query.MaxItems" value="500" />

It worked

https://community.sitecore.net/developers/f/8/p/512/1955#1955

Monday, 22 June 2015

Delete Sub Items Sitecore

All you have to do is click on the parent item and  then click on the Home tab in the Ribbon, and then click on the Delete drop-down in the Operations 


You can also Use Sitecore Rocks & Select Multiple item using ctrl

We can also use Sitecore Query Analyzer

                    Delete  From /sitecore/content/.../ItemTobedeleted/*


What about using Powershell Module.  :) 

Friday, 19 June 2015

Sitecore Query :: How to Handle Field with Space

select @#FIELD NAME# from /sitecore/content/Home

Assign value to Multilist Field to given sitecore item

                                MultilistField mf = myitem.Fields["Field Name"];
                              string query = String.Format(CultureInfo.InvariantCulture, "fast:/sitecore/content/....//*[@Name='{0}']", searchText);

                                            Item reference = master.SelectSingleItem(query);
                                            if (reference != null)
                                            {
                                                mf.Add(reference.ID.ToString());
                                            }

Assign the DateTime Field Using Sitecore API

var date = Datetime.Now;
                                if (!string.IsNullOrEmpty(date))
                                {
                                    var dateTime = DateTime.Parse(date, CultureInfo.InvariantCulture);
                                    var isoDate = DateUtil.ToIsoDate(dateTime);
                                    Item["Date"] = isoDate;
                                }


More Info

http://getfishtank.ca/blog/using-date-and-datetime-fields-in-sitecore

Tuesday, 16 June 2015

Remove ~ from media url sitecore

As said IIS need some elevated privileges in order to cater

 /~/media prefix 


So we remove this by below line of code.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      
      <setting name="Media.MediaLinkPrefix">
        <patch:attribute name="value">-/media</patch:attribute>
      </setting>
    </settings>
    <customHandlers>
      <handler trigger="-/media/" handler="sitecore_media.ashx"/>
    </customHandlers>
  </sitecore>
</configuration>


http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2012/12/sitecore-idiosyncrasies-media-urls.aspx

Disable the Upload watcher sitecore

Upload watcher automatically creates items in the Media section for files in /Website/upload folder, which may present a security risk if this functionality is not used.

Disabling Upload watcher  ensures that you can only upload files from within the Sitecore client and have control over the files that are uploaded  

When Upload Watcher is disabled, files that are placed in the /upload folder are not automatically
uploaded to the Media Library



IIS7
 <system.webServer>
 <modules>
 <remove name="ScriptModule"/>
 <add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus" name="SitecoreHttpModule"/>
 <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel"
name="SitecoreUploadWatcher"/>


IIS6
 <httpModules>
 <add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus" name="SitecoreHttpModule"/>
 <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel"
name="SitecoreUploadWatcher"/>



More detials

https://sdn.sitecore.net/upload/sitecore6/62/sitecore_security_hardening_guide-usletter.pdf