tags:

views:

90

answers:

4

We have a client who requires that all image files within SharePoint are stored in a manner that it can be shown they are a bit for bit copy of the originally uploaded file. Obviously, hashing the file would be able to show that when the file is retrieved.

What I haven't been able to find it any reference to someone implementing this functionality on a SharePoint image library. I've found numerous articles around implementing this generically in C#, but ideally I'd like to be able to do it on a standard SharePoint document/image library.

Does anyone have any suggestions as how best to go about doing this? Workflow comes to mind, but what do people think? Also, as a side to this, does anyone know whether or not SharePoint will store a bit for bit copy that will verify when we compare the checksum?

+4  A: 

You can to implement a event handler which compute your file hash on upload and to store it in a metadata text field. It's a simple solution for your problem.

Rubens Farias
+1  A: 

Why not use a Record Center site, they are designed for this sort of thing - verifiable archiving and storage.

Moo
The issue is we need to be able to prove that the files haven't been changed from their original state. It's for compliance in legal cases, so a hash seemed like the best way to demonstrate this. Record Center, while good with the auditing, etc, wouldn't tick all the boxes because of this. But thanks!
Chops
A: 

I would add a "text" column to the image library and then implement the hashing logic in an event receiver. You will need two handlers - ItemAdded and ItemUpdated. The code will look something like

    public override void ItemAdded(Microsoft.SharePoint.SPItemEventProperties properties)
    {
        base.ItemAdded(properties);
        this.DisableEventFiring();
        properties.ListItem["myCustomField"] = this.CalculateHash(properties.ListItem.File);
        properties.ListItem.SystemUpdate();
        this.EnableEventFiring();
   }
naivists
Makes sense to me! Thanks
Chops
+1  A: 

Hello

I have something simular to the above but it not for image files only, it's more for MS Office files and that is the issue. The SHA1 hashing is working great all other file types (.txt, .xml, .jpg, .zip etc) but when it comes to and MS Offices typed file (.doc, .xls, etc) the hash is always different. It here some type of issue I am unaware of.

thanks a million

BJ