<?xml-stylesheet type="text/xsl" href="https://uat.community.rws.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Scripts to Find Pages by Page Template, Update Page Metadata &amp;amp; Publish</title><link>/product-groups/tridion/tridion-sites/b/techweblog/posts/migration-script-using-coreservice-api-part-1</link><description>Let’s discuss some new pointers about CoreService API (Powerful API for Web/Tridion Developer). 
 Recently I have got a chance to work in a Migration project where I have received few requirements which are not very common. So I have planned to prepare</description><dc:language>en-US</dc:language><generator>Telligent Community 12 Non-Production</generator><item><title>RE: Scripts to Find Pages by Page Template, Update Page Metadata &amp;amp; Publish</title><link>https://uat.community.rws.com/product-groups/tridion/tridion-sites/b/techweblog/posts/migration-script-using-coreservice-api-part-1</link><pubDate>Fri, 20 Apr 2018 08:41:10 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:d47a934a-af8d-4836-8ee4-17e20c9bd00f</guid><dc:creator>Prashant  Sawant</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi Sayantan,&lt;/p&gt;
&lt;p&gt;Find the list of Pages based on Page Template TcmUri&lt;/p&gt;
&lt;p&gt;private static XElement GetAllPagesByPageTemplate(string templateTcmUri)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	UsingItemsFilterData filter = new UsingItemsFilterData();&lt;/p&gt;
&lt;p&gt;	filter.ItemTypes = new[] { ItemType.Page };&lt;/p&gt;
&lt;p&gt;	filter.IncludedVersions = VersionCondition.OnlyLatestVersions;&lt;/p&gt;
&lt;p&gt;	XElement pages = client.GetListXml(templateTcmUri, filter);&lt;/p&gt;
&lt;p&gt;	foreach (var item in pages.Elements())&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		string tcmID = item.Attribute(&amp;quot;ID&amp;quot;).Value;&lt;/p&gt;
&lt;p&gt;		\\ write code further&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;With reference to above code, client.GetListXML or client.GetList retrieve pages with only TCMID details and all other attribute returning null. &lt;/p&gt;
&lt;p&gt;Here. my problem is with the help of Page template, its return more than 5000 pages and I need to loop all the way 5000 pages. But I want only pages which are created or updated just one day before so its avoid me to loop all the pages. If we get somehow version info in the return list, we can linq list as require. &lt;/p&gt;
&lt;p&gt;Please guide me how we can add any filter in UsingItemsFilterData or how we get version info in the return list. Appreciate you help.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Prashant S.&lt;/p&gt;
&lt;img src="https://uat.community.rws.com/aggbug?PostID=6789&amp;AppID=95&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>