To get a Sitecore Content Item, use Sitecore.Data.Database.GetItem(Path)
Sitecore Content Item Class: Sitecore.Data.Items.Item
(Get Sitecore Item from “/sitecore/content/Home/myItem”)
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item myItem = master.GetItem("/sitecore/content/Home/myItem");
If item does not exist or current context user doesn’t have permission to access this item, Sitecore will return null or throw exception.
Case is Insensitive while using path to get the items.
To get a Sitecore Template Item, use Sitecore.Data.Database.GetTemplate(ID)
Sitecore Template Item Class: Sitecore.Data.Items.TemplateItem
(Get Template Item: Folder Template)
Sitecore.Data.Items.TemplateItem item = master.GetTemplate(Sitecore.TemplateIDs.Folder);
To get a Sitecore Media Item, use Sitecore.Data.Database.GetItem(Path)
Sitecore Media Item Class: Sitecore.Data.Items.MediaItem
(Get Media Item from “/sitecore/content/Media Library/Images/Logo.png”)
Sitecore.Data.Items.Item myItem = master.GetItem("/sitecore/content/Media Library/Images/Logo.png");
To get a Sitecore System Item, use Sitecore.Data.Database.GetItem(ID)
Sitecore Item Class: Sitecore.Data.Items.Item
(Get System Item “Layouts”)
Sitecore.Data.Items.Item layoutsItem = master.GetItem(Sitecore.ItemIDs.Layouts);
To get Sitecore Context Item, use Sitecore.Context.Item
Sitecore Template Item Class: Sitecore.Data.Items.Item
Sitecore.Data.Items.Item contextItem = Sitecore.Context.Item;
Note: Add Sitecore.Kernel.dll reference to project.
Hi Nehem,
ReplyDeleteI want that Sitecore users to see their own items in Workflow, want to restrict workbox to show only user specific item. Could you please provide any solution?
I want Sitecore users to see their own items in Workflow, want restrict workbox to show only user specific item. Could you please provide solution ?
ReplyDelete