Documents open read-only when user should have write access

Dullroar
  • Documents open read-only when user should have write access Dullroar

    Scenario:

    We have an internal application that ties Excel spreadsheets stored in a SharePoint doc lib with specific Opportunities in CRM. The user clicks on a button in the Opportunity and a Web page is opened that:

    1. Looks to see if a folder in the doc lib exists with the Opportunity's GUID.
    2. If not, then it creates that folder and copies an Excel file that is used as the template into it.
    3. Either way, it then opens the file in Excel.

    The code to open the file is some client-side script that figures out the location of the Excel file in SharePoint, sets an href variable to that URL and does the following:

        objExcel = new ActiveXObject("Excel.Application");
        objExcel.Visible = true;
        objExcel.Workbooks.Open(href);
    
        if (objExcel.ActiveWorkbook.ReadOnly)
        {
            objExcel.ActiveWindow.Close(false);
            objExcel.Application.Quit();
            alert("This workbook is opened for editing by another user. Try again later.");
        }
    

    Usually the above works just fine. Note that this is just opening the Excel file without checking it out.

    Problem:

    Once in a while, and for no reason I can figure out, a user will click the button and the spreadsheet will be returned to them by SharePoint as read-only (so they will get the above error message). However, often they are demonstrably the only user to have accessed the document - in fact, sometimes this will happen if they just created the document (i.e., they clicked the button, the folder didn't exist, and so it creates the folder and copies the new Excel file into it). Sometimes they were working on it earlier and then return and get the above message. Waiting for a while can help, but it doesn't seem like even SharePoint's inactivity timeout always does the trick. And here's the strangest part - while that user opening it may get it returned to them as read-only, often other users, even multiple other users, can click the button and the spreadsheet will open for them in edit mode!

    Questions:

    1. What is causing this behavior? I can change the code to avoid it if I can figure out why it is happening.
    2. Is there any way through the SharePoint UI or APIs to "release" the document so that the original user can open it for editing?
    3. Is there any way through the SharePoint UI or APIs to tell who SharePoint thinks has the document open for editing (although in some cases that seems like it is going to be the user who is getting blocked).

    I am stumped and would appreciate any help or suggestions.

  • When you open a file from SharePoint, a copy is created locally. In some cases the local copy is not cleaned up and can cause the problem you are getting.

    Here is a post from someone with the same error, there are a couple of suggestions towards the end.

Related questions and answers
  • then navigate to any other page, and then click BACK or FORWARD I get an error message that says "Webpage has expired". Note that my web.config entry is: <httpRuntime executionTimeout="43200" maxRequestLength="104856" /> After searching I found https://stackoverflow.com/questions/1580085/show-webpage-has-expired-on-back-button. Well, obviously I can’t use GET because I am developing a web...-scope is only within the web part NOT the full page. Also, I do not want to use any AJAX-controls. Update: I was told that the only way to get rid of "Webpage has expired" error is either by: Using

  • We have a SharePoint 2007 deployment which will have a substantially large document library. My client wants the ability to export this library to an Excel spreadsheet, but specifically wants... to Spreadsheet, but it does not appear to support automated subdivision of the list items into separate worksheets. I do not know if Excel Services that come with MOSS are capable of it, but we do not have MOSS so we cannot consider it an option for now. EDIT It seems that by mentioning "out-of-the-box", I am implying that I'd prefer something quick and simple. Let's dispel that. I do a lot

  • , the only Neat way I can see through it is some sort of "Configuration" page, which then does it via the Web Services. But this is a pain, with the user having "Activate" the feature and then "Activate...), then there doesn't seem to be a way to just get a reference to the page, it always wants to overwrite it with a new file. But I dont want to do that, I just want to add a Web Part to the existing page. See my... it to the default.aspx home page. I would be happy either way. Note: I want to be able to activate this on existing site, I dont want to create a new Site Definition. Here is what I have tried: Feature Receiver

  • I have a document library using a document set content type. I can create a new document set through the UI and it works perfectly. I'm now trying to create a document set in this library programmatically and it's not working properly. Here is the code (based on MSDN documentation): // Set some properties Hashtable properties = new Hashtable(); properties.Add("UploadComplete", false... for the set looks like a folder instead of the document set icon clicking on the document set doesn't show the document set home page, it just behaves like a normal document library running CAML queries shows

  • and they do not work. I have found the code that I can place in the machine.config file that turns off the check, but I would like to figure out what is going on with this. I have ensured that debug is set to false in the web.config file as well. It is only my user controls that are causing the issue, but I do not know why. So it would be nice if there was a list of known .Net assembles that were not FIPS compliant or some way for me to determine what library is calling the offending code. Any ideas, thoughts, insights are welcome! Update: I wanted to point out that my controls are not used

  • be opened. For applications using SharePoint web services we will extend the web application and have an internal url with only Windows authentication enabled. ...We recently migrated some applications from SharePoint 2007 to SharePoint 2010. The application uses the SiteData.asmx web service. After the migration there are Access Denied errors, withtout any...;string item; service.GetURLSegments(url + "Docs/SomeDocumentLibrary/Test/testafterupdate/2007-00152-01-E.doc", out web, out bucket, out list, out item); The point is to get the listId from the url

  • ? I can't for the life of me determine why some files are throwing this error while others are copying just fine. UPDATE The files copy without any problem if we go into the doc lib's settings...I have a document library which contains some Word documents that I'm trying to copy down to my local disk. I've opened the document library using Windows Explorer, and am dragging the individual files from that window to a folder on my local PC. Some files work, but others are giving me this error (on Windows 7 x64): The file name you specified is not valid or too long. Specify a different

  • mysubdomain.mydomain.com/sites/aaa/cc and this two sub sites have different set of user. So to summarize my question. I want to get as result of SQL query table with username (NT\login) with information about sites/sub-site and permission level. My question is: Is this possible? Another question: Is there any method how to get this information without installing anything on server side of SharePoint farm? I... name and site owner could be added in second step. For me it is more logical to have just information pulled from site Site/sub-site URL, NT\login of user and permission level (contribute, read, …) So

  • for some users, and only when they are sitting in particular chairs? Any help would be appreciated. Thanks for reading. Anonymous Darryl. ... in another list based on a lookup. I have two users, call them Jane and John. Jane is a member of several SP groups, one of which has Full Control permissions. John is a member of a couple of SP groups.../. I have contradictory observations: When John adds an item to the library while working from W2, the workflow is initiated but goes to Stopped status, and the other list is not updated. When John

Data information