I have a requirement like when a user copies an existing page by doing this data sources also copied and the user may not realize when they change content on this item they are changing on the original datasource as well. Is there a way to find out if an item's datasource is shared between multiple pages.
1 Answer
You can check by clicking Navigate => Links
on Datasource
item, it will show the list of associated items
Update - You can use Link Database via GetReferrers
method. e.g.
var links = Globals.LinkDatabase.GetReferrers(item);
if (links == null)
return new Item[0];
var linkedItems = links.Select(i => i.GetSourceItem()).Where(i => i != null);
-
Thanks for your comment. Actually instead of navigating through each item presentation details and getting the datasource and checking item reference. Is there any way to get the list of reference items of datasource through C# sitecore api/– HarishCommented May 24, 2021 at 11:32
-
Yes you can create powershell script or simple aspx page for this and write code there to retrieve list Commented May 24, 2021 at 11:44
-
Thank you Gaurav. I will work on it to find the list of item references.– HarishCommented May 24, 2021 at 12:58