I have a .Net application that (amongst other things) provides a front end to a sharepoint document library. Users are able to open documents, and I use the Open Documents Control to do so (http://msdn.microsoft.com/en-us/library/ms454230%28v=office.12%29.aspx).

Most of the time the documents should be opened in edit mode, but certain documents should only be opened in read only mode (say I have a custom 'Category' field on each document, and if the category equal to 10 then the document should be read only). I currently use the EditDocument3 method to open files (http://msdn.microsoft.com/en-us/library/cc264288%28v=office.12%29.aspx). However, I don't seem to see a way to open in a read only mode.

One thought I had would be to update the permissions of every user to only have Read access on that particular file, but I figured this would kill performance (some hundreds of users, some 160gb of files, documents changing from edit to read only fairly frequently).

Is there a way to flag a document as read only in sharepoint? I access sharepoint using c# through the object model.

2 Answers 2


You can force a document into read-only by enabling security options, and restrict editing by requiring a password. This can be done manually when a document is created /saved by the author.

Executing server side you could have a custom workflow that will check your column for the specific setting, and modify the document XML to enable the protected mode. There is a <w:documentProtection> element where these settings are applied. If you use the OpenXML SDK you have access to the DocumentProtection class that sets those same properties.

Another alternative is to utilize the word automation service (aka document conversion process). There are plenty of third party plugins, and there is a project hosted on CodePlex that adds a custom designer activity for doing quick workflow document conversions with SharePoint Designer.

  • This would work for Word documents only, is that right? When I said documents, I should have said that this was a generic term, so included text files, PDFs, etc.
    – John
    Commented Oct 7, 2011 at 10:19
  • The document security settings, either manual or code will work the main MS apps (word, excel, PP). Automation services can be updated to convert any document to any other document type. The PDF specification has separate controls to enable protection. There is no "one size fits all solution" as it varies based on document type, as well as the client you utilize to access that document. Commented Oct 7, 2011 at 13:03

Here's a potential workaround:

  1. Create a library where your users don't have permission to edit documents.
  2. Send documents to this library when they need to be read-only.
  3. Conditional on the category, switch the link for your normal document in your normal library to the link for the read-only document in the read-only document library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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