Removes lock with the specified token from this item or deletes lock-null item.
If this lock included more than one hierarchy item, the lock is removed from all items included in the lock. If the lock-null item is unlocked using this method then it must be removed from the WebDAV hierarchy.
public WebDAVResponse Unlock(string lockToken)
{
LockInfo[] locks = ActiveLocks;
int i;
for(i=0;i<locks.Length;i++)
if(locks[i].Token == lockToken) break;
if(i == locks.Length)
return new PreconditionFailedResponse();
if(this is ILockNull)
{ // delete lock-null item
DeleteThisItem();
}
else
{ // remove lock from existing item
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd;
conn.Open();
try
{
cmd = conn.CreateCommand();
cmd.CommandText = "DELETE FROM Lock WHERE Token LIKE @Token";
cmd.Parameters.Add("@Token", SqlDbType.NVarChar).Value = lockToken;
cmd.ExecuteNonQuery();
}
finally
{
conn.Close();
}
}
return new NoContentResponse();
}
ILock Interface | ITHit.WebDAV.Server Namespace