Cancels the checkout and restores the pre-checkout state of the version-controlled item.
In your UnCheckOut implementation you will discard changes and restore pre-checkout state. Content and properties must be copied from current version to this item. The item must be marked as checked-in.
public WebDAVResponse UnCheckOut()
{
// Discard changes.
// Copy content and properties from current version to this item. Mark item as checked in.
Version version = (Version)this.VersionHistory.CurrentVersion;
using (SqlConnection conn = new SqlConnection(fConnStr))
{
// Restore properties.
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "DELETE FROM Property WHERE ItemID = @ItemID";
cmd.Parameters.Add("@ItemId", SqlDbType.UniqueIdentifier).Value = this.fItemId;
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Property"
+ " (ItemId, Name, Namespace, PropVal)"
+ " SELECT @ItemId, Name, Namespace, PropVal"
+ " FROM VersionProperty"
+ " WHERE VersionId = @VersionId";
cmd.Parameters.Add("@VersionId", SqlDbType.UniqueIdentifier).Value = version.VersionId;
cmd.ExecuteNonQuery();
// Restore content.
File.Copy(version.FilePath, this.fFilePath, true);
// Mark item as checked in.
SetResourceCheckedOut(false);
}
return new OkResponse();
}
IVersionableItem Interface | ITHit.WebDAV.Server.DeltaV Namespace