4

I am trying to get user comment from Components in folder using the core service. This should be available something like:

componentData.VersionInfo.UserComment().ToString();

where componentData is:

XElement componentListElement = client.GetListXml("folderTCM", filter);
foreach (XElement organisationItem in componentListElement.Elements())
{
    var data = client.Read(organisationItem.FirstAttribute.Value, new ReadOptions());
    var componentData = new ComponentData();
    componentData = (ComponentData)data;
}

The UserComment() function does not exist. Has anyone tried to get the user comments from a component?

7

Do somthing like below:

XElement componentListElement = client.GetListXml("folderTCM", filter);
foreach (XElement organisationItem in componentListElement.Elements())
            {
               var data = client.Read(organisationItem.FirstAttribute.Value,
                                                                           new ReadOptions());
               var componentData = new ComponentData();
                componentData = (ComponentData)data;
FullVersionInfo fullVersionInfo = (FullVersionInfo)componentData.VersionInfo;
string Comments = fullVersionInfo.UserComment;
}
10

I think you can use FullVersionInfo by getting the component's VersionedItemData.

Something like this:

VersionedItemData versionedItemData = (VersionedItemData) client.Read(organisationItem.FirstAttribute.Value, new ReadOptions());
FullVersionInfo fullVersionInfo = (FullVersionInfo)versionedItemData.VersionInfo;
string userComment = fullVersionInfo.UserComment;

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.