1

We did bulk component update using core service and while updating those components we saved specific comment.

Using core service or TOM.Net API, is there any method that can give the component based on schema and comment that was saved during component update.

The alternate approach that we can use is to filter before and after time for the update however since business users were also updated component during that time so we want to filter out only the component that were updated by our utility.

Code to update component as requested:

_client.CheckOut(tcmId, true, new ReadOptions());
_client.Save(componentData, new ReadOptions());
_client.CheckIn(tcmId, true, message, new ReadOptions());

Here, _client is the core service cliennt object and message is the user comment.

Any help is appreciated.

  • How did you save the "Comments", in form of a component field value or app data? – Saurabh Gangwar May 18 '16 at 6:51
  • Using the checkin method to provide the user comments. – Hiren Kaku May 18 '16 at 7:01
  • Can you add the code snippet for updating the component? – Saurabh Gangwar May 18 '16 at 7:04
2

To get the components based on schema, you can use the below code. If you have multiple schemas, you can loop and collect the results.

UsingItemsFilterData filter = new UsingItemsFilterData();
            filter.BaseColumns = ListBaseColumns.Extended;
            filter.ItemTypes = new ItemType[] { ItemType.Component };
//"tcm:0-7-1" is the publication in which I want to search components
            filter.InRepository = new LinkToRepositoryData() { IdRef="tcm:0-7-1" };
//"tcm:7-x-8" is the schema
            XElement items = client.GetListXml("tcm:7-x-8", filter); 
// you can also use below method, if you want to get objects in place of XML
//var items = client.GetList("tcm:7-x-8", filter); 

Now when you have collection of components, you can check the comments in components and filter the collection.

  • I think, you did not read the question carefully. I want to retrieve the version of the component with the comment and not list of components based on schema. – Hiren Kaku May 18 '16 at 7:33
  • Sorry, but you did not mention "version" in your question. but you can loop through the versions of the component once you get it. – Saurabh Gangwar May 18 '16 at 7:40
  • Ok, can you please modify your code to indicate how can I access user comment? – Hiren Kaku May 18 '16 at 7:58
  • Hiren, could you please check the component xml of such a component and paste here the comment block. I am not able to find out userComment in my component data. Once you have that you should be able to see user comment by componentData.userComment – Rakesh Choudhary May 18 '16 at 14:43
  • 1
    @RakeshChoudhary you will found comment in Versioninfo of Component XML <tcm:SystemComment>Updated</tcm:SystemComment> <tcm:UserComment/> – Bhagat May 20 '16 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.