Sharepoint - Can we unlock a ShortTerm lock via CSOM for SP2013
AFAIK, nothing in the client-side API can allow this.
However, there's an old technology called "Front-Page RPC" (the name itself shows you how old it is!) that may be still available on SP2013 (even if it's kind of deprecated/not really documented). It is still there since it's used by Office applications to communicate with SharePoint.
FP RPC is a kind of WebDav protocol, i.e. it's HTTP requests (mostly POST requests) you must send to the server. I have a sample in VB.NET (sorry, it's VB.NET, I don't find the C# version in my archives):
Public Sub UncheckoutDocument(ByVal SiteUrl As String, ByVal FileUrl As String)
SendPostRequest(SiteUrl + "/_vti_bin/_vti_aut/author.dll", _
"method=uncheckout+document%3a6%2e0%2e2%2e5523&service%5fname=%2fsites%2fcompta&document%5fname=" & HttpUtility.UrlEncode(FileUrl) & "&force=true&rlsshortterm=true")
End Function
Private Function SendPostRequest(ByRef Url As String, ByRef Body As String) As String
Dim Request As WinHttp.WinHttpRequest
Request = New WinHttp.WinHttpRequestClass
Request.Open("POST", Url, False)
Request.SetCredentials("user", "password", 0)
Request.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
Request.SetRequestHeader("X-Vermeer-Content-Type", "application/x-www-form-urlencoded")
Request.SetRequestHeader("MIME-Version", "1.0")
Request.SetRequestHeader("User-Agent", "MSFrontPage/6.0")
Request.Send(Body)
Return Request.ResponseText
End Function
The problem here is with authentication. The code above is for Windows authentication. It won't work for Office 365.
What you have to do is remove the line Request.SetCredentials("user", "password", 0)
to set instead an authentication cookie. You can probably get that authentication cookie first by using, for instance, the MsOnlineClaimsHelper
class I've just found at http://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx.