Is there a way to set any document as readonly incase there is not activitity (Modification) for more than 6 months

john john 1,006 Reputation points
2023-03-10T18:23:49.4733333+00:00

We have around 28 sites which contain around 2,000,000 documents. now we want to apply a policy is that if a document is not been modified for 6 months to set the document as read-only. so what are the approaches we have to apply this ?

Thanks

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,572 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,781 Reputation points Microsoft External Staff
    2023-03-13T09:47:47.8+00:00

    Per my research, there is no direct way to automatically set SharePoint documents as read-only mode based on modified date condition. The read-only mode can be set only on SharePoint site collection.

    As a workaround, you could set all documents in the document library as read-only mode by following JSON codes. Note: JSON codes are for Name column.

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "a",
      "txtContent": "@currentField",
      "attributes": {
        "target": "_blank",
        "href": "[$FileRef]"
      }
    }
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.