Scan for viruses

Hi

Can I scan each document uploaded to a document library? And if a document is infected with virus, can I programmetically find it out and move the infected file to a separate document library?

Thanks in advance

Kiran

[246 byte] By [kIRANSREDDY] at [2008-1-10]
# 1

Kiran,

You should look at products like ForeFront

http://www.microsoft.com/forefront/serversecurity/sharepoint/default.mspx

These products integrate in the the VSAPI (Virus Scanning API) and allow you to scan on upload/download and manually. If you really wanted a challenge you could look at writing your own but thats not something I would take on lightly.

Andrew

andrewwoodward at 2007-10-3 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - General Question and Answers and Discussion...
# 2

Andrew,

Thanks for your response.

I have installed ForeFront on the server. I have found that it only provides an administration console to configure scans. But how do I know that a file uploaded by the user contains virus? It does not seem to provide any programming interface.

For example, a user uploads a file which contains virus. Then my event handler should redirect the file to a separate document library called "Infected Files" and inform the user.

Can the above situation be handled programmatically?

Thanks again

Kiran

kIRANSREDDY at 2007-10-3 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - General Question and Answers and Discussion...
# 3

Kiran,

From SharePoint Central Admin you have the Anti-Virus configuration options where you can set the rules around, scan on upload/download and what to allow/prevent.

You do not get the option to 'move these to another document library' as this would also be prevented using the scanning and you are not able to configure that level of granularity.

I am not aware of any way you can hook into the API to roll your own features either, although the out of the box product should cover you for most scenarios. In your example I would set up anti-virus to prevent upload and inform the user the file contained a virus (you do not want files with viruses in the sharepoint databases).

Andrew

andrewwoodward at 2007-10-3 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - General Question and Answers and Discussion...
# 4

Thanks Andrew. This information helps.

I have one final question. In my current project, one way of uploading the documents is through a windows upload tool which uses a custom web service in sharepoint. In this scenario, I need to know the virus scan status of a file uploaded by a user using the windows upload tool.

I found there is a SPBuiltInFieldId.VirusStatus field in WSS. I could not figure out if I can use this in my programme. Can you please let me know if there is any thing in the object model that tells me the virus scan status for an item in the above scenario?

Thanks again

Kiran

kIRANSREDDY at 2007-10-3 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - General Question and Answers and Discussion...
# 5

Kiran,

Uploading using the web services (built in or custom), and office or explorer view of that matter, will all pass through the VSAPI so ForeFront will catch/scan and return/throw an error. You can test this using the EIRCAR.COM test virus (details should be part of the ForeFront documentation).

I have not used the VirusStatus field but assume this is used when you allow the document to be uploaded or do manual scan but don't clean the file.

Andrew

andrewwoodward at 2007-10-3 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - General Question and Answers and Discussion...
# 6

Andrew

I will give it a try. Thank you very much for the help.

Thanks

Kiran

kIRANSREDDY at 2007-10-3 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - General Question and Answers and Discussion...

SharePoint Products and Technologies

Site Classified