Calculate has of document in SharePoint Online RRS feed

  • Question

  • Hello!

    I need to calculate hash of document (using sha256) in SharePoint Online.

    How can I do that? Can I use only JavaScript?

    Do I need to do it using Add-In?

    Thank you!
    Monday, May 7, 2018 11:50 AM

All replies

  • Hi Analytick,

    Short answer: yes you will need an app or use PowerShell because this is not available OOTB.

    Long answer:
    It is not clear if you need to calculate the sha256 for documents that are already present in SharePoint Online or whether you want to calculate the sha256 during upload and then capture the document's sha256 value into a SharePoint column. Of if you simply want to keep a list (outside SharePoint) with the sha256 value for each document.

    The solution needs to cater for the following:
    - there are several ways to add documents (e.g. through browser upload, Office Online, Explorer view, REST API, move from other libraries, ...)
    if each document needs a sha256 value then you need to cater for each possible way for users to upload documents
    - SharePoint inserts metadata into certain file formats (e.g. docx, xlsx, msg, tiff) upon uploading. This changes the content of the file and the resulting sha256 will be different from the sha256 from the original item.
    - there are JavaScript implementations. Please be aware that the documents needs to be downloaded to the client for the calculation of the sha256. The download is also necessary for PowerShell. 
    - document versions

    Paul | SLIM Applications

    • Proposed as answer by Dennis Guo Monday, May 14, 2018 7:35 AM
    Tuesday, May 8, 2018 6:35 AM