Tuesday, June 28, 2016

Dealing with "File is locked for exclusive use..." Issue in SharePoint 2013.


A lot of articles exist on the internet on how to deal with this issue so you will be wondering why i still bother to expend energy on the topic. 

Well, this wouldn't have been necessary if these articles i mentioned actually addressed the issue i had today while trying to achieve something that should have been very easy to do - Delete a file from a Document Library.

It happened that the colleague i assigned to upload a form (word document) for download by all staff within the organisation gave everyone permissions to upload and download documents in the library - whoosh!!.

As you would guess, some persons played around with the original documents, leaving his details on the form and refusing to close the form on his client. In the end the document was locked and i could not check it out or even delete it to enable me upload a fresh one. I was stuck. I was embarrassed.


What Things Did I Try?

Internet Surfing

Well, i searched around the net for ways to override checkout. 

Some article suggested that the lock will resolve itself after 10 minutes. 30 minutes and several user complaints later , issue was still there. It turned out that this works in 80 % of cases where the Short Term lock feature in Microsoft Office Clients actually renews itself every 10 minutes.

Others suggested Powershell route and i tried the scripts. File was still locked. The scripts must have worked in some scenarios as suggested by comments trailing the posts.

http://www.sharepointdiary.com/2014/12/the-file-FILEURL-is-locked-for-exclusive-user-by-USER.html

https://pholpar.wordpress.com/2014/04/03/how-to-use-powershell-to-delete-short-term-locks-from-documents-opened-from-sharepoint/

Some gave out .NET codes
http://www.codeproject.com/Articles/251161/Resolve-SharePoint-Document-Locked-for-Editing-Iss

3rd party tools: Truth is, i don't experiment with unsigned and untested tools on my production environment

http://think4code.blogspot.com.ng/2012/07/sharepoint-2010-file-is-locked-for.html 


Social Engineering: 


I picked up the username of the user (this is easily visible in the error popup) that had the document locked and called him. He swore by his ancestry that all his word documents were closed. Promised he will see what he could do. I moved on.

Other Things i tried: 

  • Reduced permission level of everyone on the document library. 
  • Tried to knock the user out with an IIS reset (desperate me). The locking actually information actually exists within the content database so this surely failed.

Made Coffee: 

Not worth a place in this article.

Why was my Case Different?

Well, maybe because the document was an older version word document (.doc) which does not allow for Co-authoring on SharePoint.
The article below pointed me in that direction
http://sharepoint-community.net/profiles/blogs/sharepoint-2013-multi-authoring-this-file-is-locked-for-editing

The next things i did quite simply resolved the issue for me

From the Document Library

1. Adjust Library Settings

  • Go to Library settings
  • Version Settings
  • Under Document Version History, select No versioning
  • Under Require Checkout, select Yes
  • Click OK
2. Adjust Library Settings

  • From the Library, Go To Advanced Settings
  • Under Open Documents in Browser, select second option (Open in browser)
  • click OK
3. Select the document again and try to Check out.
It should work.

Delete document afterwards

Hope this helps someone.

Monday, September 30, 2013

Enforcing capital letter of every word - InfoPath 2010

Use the translate function to convert the letters to Capital. 
  1. Go to text box properties. 
  2. Click on fx button beside default value box. 
  3. Click on insert function. And select translate function. 
  4. Select the text box field as the first parameter, 
"abcdefghijklmnopqrstuvwxyz" as the second parameter and "ABCDEFGHIJKLMNOPQRSTUVWXYZ" as third parameter.

How to enforce captalisation of first letters of any word in Infopath Forms


  1. In InfoPath 2010, create a new Blank Form template.
  2. On the Home tab under the Controls group, click Text Box to add a text box control to the form template.
  3. Click the text box control to select it.
  4. On the Properties tab under the Properties group, click Default Value. 
  5. On the Field or Group Properties dialog box on the Data tab in the Default Value section, click the Insert Formula button behind the Value text box. 
  6. On the Insert Formula dialog box, type in the following formula into the Formula text box, and click OK.

     concat(translate(substring(., 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring(., 2, string-length(.) - 1))



  7. On the Field or Group Properties dialog box, click OK.


  8. Press F5 to preview the InfoPath form.