public bool IsCheckedOut(SPList list, SPListItem listItem) { var cacheId = string.Format("SharePointFile:{0}_{1}", list.Id, listItem.Id); var isCheckedOut = (bool?)cacheService.Get(cacheId, CacheScope.Context | CacheScope.Process); if (isCheckedOut == null) { using (var clientContext = new SPContext(list.SPWebUrl, credentials.Get(list.SPWebUrl))) { var spfile = clientContext.ToFile(list.Id, listItem.Id); clientContext.Load(spfile, item => item.CheckedOutByUser); clientContext.ExecuteQuery(); isCheckedOut = !(spfile.CheckedOutByUser.ServerObjectIsNull ?? true); cacheService.Put(cacheId, isCheckedOut, CacheScope.Context | CacheScope.Process, new string[0], CacheTimeOut); } } return(isCheckedOut.Value); }