Sunday, May 31, 2009

Getting Ancestor item based on Template ID

public static Item GetAncestorItemBasedOnTemplateID(Item item)
{
var filter = "";

filter += string.Format("contains('{0}', @@templateid)", item["templates"]);
return item.Axes.SelectSingleItem("ancestor-or-self::*[" + filter + "]");
}

Sunday, May 3, 2009

Getting user from SC6

  1. if(User.Exists(domainUser))
  2.             {
  3.                 var user = User.FromName(domainUser, false);
  4.                 return !string.IsNullOrEmpty(user.Profile.FullName) ? user.Profile.FullName : user.LocalName;
  5.             }

Increasing the allowed Media file size

The following web.config changes, will enable bigger size Media item to be upload.

<httpRuntime maxRequestLength="20480" executionTimeout="600"/>

and 

<setting name="Media.MaxSizeInDatabase" value="20MB"/>

Those changes will increase the allowed file size to 20MB

Thursday, April 23, 2009

Check if the Item is children of TargetItem

childItem.Axes.IsDescendantOf(parenItem);

Tuesday, April 21, 2009

Clear Server Cache Inteface

Caching contents to speed up processing of contents can be done on the client machine as well as on the server. There are times things do not go according to what we want it to be because of caching. Fortunately, clearing server cache in Sitecore is not as complicated as I initally thought. To clear server cache go to the Sitecore Clear Cache interface which is 

www.yourwebsite.com/sitecore/admin/cache.aspx.