Example checking in a Component with a user comment
The following code includes a comment provided by the user while checking a Component.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Tridion.ContentManager.CoreService.Client;
namespace MyOrganization.ContentManager.Tests
{
public class CodeSample
{
CoreServiceClient _CoreServiceClient = new CoreServiceClient();
ReadOptions _ReadOption = new ReadOptions()
{
LoadFlags = CoreService.Client.LoadFlags.None
};
}
public void CheckInItemsWithUserComment(string componentId)
{
ComponentData component =
(ComponentData) _CoreServiceClient.CheckOut(componentId, true, _ReadOption);
component.Title = "Updated Title";
component = (ComponentData) _CoreServiceClient.Save(component, _ReadOption);
_CoreServiceClient.CheckIn(id: component.Id, removePermanentLock: true,
userComment: "Title Updated", readBackOptions: _ReadOption);
}
}