Share via

Making LockServerFile Method Work In Sharepoint Online

Anonymous
2022-11-01T22:20:30+00:00

My company is in the process of migrating from classic SP to Sharepoint Online, and I manage several macro-enabled Excel projects. Most of these projects open other common Excel files, and check if another user has the file open by using the LockServerFile method. This works because the classic Sharepoint site opens every file as read-only by default. However, the new Sharepoint Online sites open in edit mode, and calls to LockServerFile result in an error. I did not create these projects, and was told that attempts to use Check In/Check Out in the past to try to restrict users to editing one at a time had caused issues in the past, so I am trying to avoid that. My questions are the following:

  1. Is there some kind of setting within Sharepoint that can make all files (or at least Excel files) open as read-only by default?
  2. Assuming the answer to my first question is yes, is LockServerFile still compatible with SPO?
  3. If I can't use LockServerFile, is there any alternative outside of Check In/Check Out, or is that my only alternative?

Thank you

Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2022-11-02T03:26:02+00:00

    Are you saying that one of these permissions levels would achieve that? <<

    No. If they need edit permissions, they need edit or above - View only (or Read) would solve only the problem of opening the files in read-only mode to start - but the users would not be able to edit.

    Someone in the Q&A forum should be able to tell you if what you need is possible and provide a solution.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-11-02T03:08:39+00:00

    Hi Diane,

    Thanks for your response. I'm totally sure I understand what you mean regarding permissions. To my knowledge, the permissions options are Full Control, Design, Edit, Contribute, Read, and View Only. What I need is functionally that still allows users to edit the document while also always opening the file as read-only by default. Are you saying that one of these permissions levels would achieve that?

    I will also try posting my question in the location you linked.

    Thank you

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-11-02T02:05:22+00:00

    Hello TsukubaGT1

    I'm Diane, a Microsoft 365 Apps & Services MVP and I'll try to help you today.

    The problem with check out/ check in is that people forgot to check in. :(

    The users need Edit permissions, correct? Giving everyone Can view permissions would open the files as read-only.

    This forum is targeted to end-users, not admin issues and while some of us can answer some of these questions, the new Q&A forums are better suited for these questions. The admins there should have better suggestions. :)

    https://docs.microsoft.com/en-us/answers/products/office

    Unfortunately, moderators are unable to move messages to that forum, so you'll need to repost it.

    -- Diane

    Give back to the Community. Help the next person who has this issue by indicating if this reply solved your problem. Click Yes or No below.

    Was this answer helpful?

    0 comments No comments