Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We're getting this a lot lately.

  • Windows 2008 Server
  • Windows 7 & Vista Client PC's
  • Microsoft Office 2007

When a user tries opening a file on our network drive (word doc, excel spreadsheet, etc) the software reports the file is locked by 'another user' even when it's not. They're also seeing random 'Sharing Violation' errors when trying to save files to the network.

Possibly the same manifestation of the problem shows up when a user tries saving a local, on their own drive, non-network files and they get 'Can not save due to a Sharing Violation'.

share|improve this question
add comment

7 Answers

up vote 5 down vote accepted

OK, after tracking down potential problems and testing solutions since this question was posted I have the answer...

Anything that accesses files in real time (antivirus, syncing, or indexing software) can potentially create problems with Microsoft Office files.

Microsoft Office creates temp (with and without a file extensions) files when saving. Overzealous realtime scanning programs sometimes see these temp files, try and read their contents, and in doing so initiate file locks. This causes instant problems when the parent application tries to convert the temp file back to its intended format.

From MSKB: Description of the way that Excel saves files

When Excel saves a file, Excel follow these steps:

  1. Excel creates a randomly named temporary file (for example, Cedd4100 with no file name extension) in the destination folder that you specified in the Save As dialog box. The whole workbook is written to the temporary file.
  2. If changes are being saved to an existing file, Excel deletes the original file.
  3. Excel renames the temporary file. Excel gives the temporary file the file name that you specified (such as Book1.xls) in the Save As dialog box.

From MSKB: Description of how Word creates temporary files

A simplified view of the scheme used to save an edited file

Create temp file
Write temp file
Delete original file
Move temp to target name

Word gains significant performance speed by placing the temporary file in the same directory as the saved file. If Word placed the temporary file elsewhere, it would have to use the MS-DOS COPY command to move the temporary file from the other directory to the saved location. By leaving the temporary file in the same directory as the saved document file, Word can use the MS-DOS MOVE command to quickly designate the temporary file as the saved document.


Most av, indexing, and syncing software handle the temp files correctly; some don't. And some work fine on their own but not well together when watching the same folder. It's up to you to figure out what program is causing the issue in your environment. Hopefully this answer gives a guiding light in the right direction.

Update: Microsoft has released a couple hotfixes to address this issue.
Office 2007 Hotfix
Excel 2007 Hotfix
Instead of requesting the hotfixes from MS, search for them at The Hotfix Share.

FYI: Neither completely solves our problem but they do significantly reduce "sharing violation" frequency.

share|improve this answer
add comment

Something that I've noticed using Windows Vista is that it does 'lock' files at random. I use Unlocker to show me where it is locked and it allows me to unlock the file.

-JFV

share|improve this answer
1  
Thanks for the tip JFV. I used to use Unlocker until we moved to Vista x64. Now we use LockHunter. lockhunter.com/index.htm –  GollyJer Jun 18 '09 at 23:42
    
Also another tool worth a mention is: ffunlock, diamondcs.com.au/freeutilities/fileunlocker.php No install required. –  Qwerty Jun 30 '09 at 23:40
add comment

Is it possible that other users are somehow disconnecting from the share without closing the application first? i.e. laptop users that simply close the lid for Standby and go home? Perhaps other network connectivity issues?

I'd look in the shared drive for lock files - they usually start with a tilde. For example, document.docx would have a lock file in the same directory that would be ~$document.docx. This is a hidden file, so you need to enable Show Hidden Files And Folders in Explorer to see it.

If the application sees this file, regardless of the permissions actually granted, it will tell you the file is locked because it didn't generate that lock file. If an application didn't close correctly, or was forcibly disconnected by going into standby or being unplugged from the network, it won't properly remove that lock file.

Just a thought...

Jes

share|improve this answer
add comment

The error indicates that the other user has locked the file when this user tried to open it. The read/write access controls for this user have no significance when the lock is present.

Possible reasons,

  • Is the file being stored in locations that are shared with write access?
  • Did the previous access of the file terminate with an application crash?

MS Office applications usually open files in write mode. If someone has it opened, or if the application crashed the last time with this file open, you are likely to get this error.

Another small observation: have you noticed, a doc/xls file that is open but not yet edited actually has its timestamp modified to when it was opened (if you switch to explorer and see its listing). This is restored to the older timestamp if you close the file without any edits/save. This is because the file is opened in write mode.

share|improve this answer
add comment

Check too that they have the ability to create files in that folder. The program tells if it is allowed to write by the pressence of a ~$document.docx (or whatever) that it holds. If it can not create that file or another program has the handle to it it then assumes it is read only.

share|improve this answer
add comment

Microsoft Office applications gets the username from the field in options under the general tab of excel, user information tab in word etc.

check the clients to see what the field has in it in the tab.....

share|improve this answer
add comment

Turn off the Details Pane shown at the bottom of Windows Explorer. Go to Organize -> Layout -> Details Pane. That fixes the first problem.

Turn off Show pop-up description for folder and desktop items Click on Tools -> Folder Options. In the box that opens up, click on the View tab. Scroll down the list to Show pop-up description for folder and desktop items, clear the checkbox and then click OK. This fixes the second problem.

Turn off Preview Pane. Go to Organize -> Layout -> Preview Pane. This fixes number 3.

share|improve this answer
    
It's actually far easier and far more effective to simply enable "classic" mode. –  John Gardeniers Oct 21 '12 at 0:26
add comment

protected by Michael Hampton Mar 31 at 11:29

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.