RE: BizTalk Adapter for Sharepoint

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Gilles [MSFT] (Gilles_at_online.microsoft.com)
Date: 09/15/04


Date: Wed, 15 Sep 2004 23:28:08 GMT

Hello,

>Thanks to the very nice sharepoint adapter, BTS got the functionality to
>send docs to SP libraries, great! Now, please enlight me, does anybody know
>how those lists can be cleaned/purged? Is there some kind of maintenance
>guideline - or best practice? Do we have to develop a custom event handler
>or is there another way of doing this? Somebody must have thought
>of/experienced this before...

Sharepoint out of the box does not offer a way to automatically "purge" lists or document libraries.
Sharepoint assumes that if you put something in a document library or a list, you want to keep it until you explicitely delete it.

Best practices depend on many things: the number of users, the number of documents per hour being dropped, their size, your actual
application (sometimes you might need to keep things around longer ...) so it is hard to formulate them without any knowledge of your solution.
Sharepoint has limitations on the number of files per document library and the number of document libraries.
However, I do not remember them. It is better to ask the Sharepoint specialist in the appropriate newsgroup.

You can maybe find an existing solution that conditionally deletes sharepoint files. I do not know of any but it is reasonable to assume that
at least one ISV developped one.

I can think of an obvious while effective best practice: do not store a document into sharepoint if the document will not be edited/viewed.
In other words, try to use sharepoint for documents which require user edition/viewing only.

As far as implementing this solution yourself, it is in fact relatively easy.
Sharepoint offers an object model and a few web services that you can use to manipulate content.
This allows you to enumerate and delete documents and much more. There is a catch: the WSS object model can be called only
from code which runs on the same machine as the server. The web services can be called from anywhere (provided that the user has
the adequate privileges) but offer much less methods than the object model and is slower than the object model.

You have essentially two ways to implement your cleanup:

1) An event handler (per document library). Every time a document is dropped, you scan the library and delete it.
     You could be tempted to "filter" adds in the event handler:" decide if the document should be put or not and delete it if it should not be kept.
      Resist that temptation. Events are fired asynchronously with the respect of the file being saved to the sharepoint store. As a result, you will
      slow down the performances of your server. It is better to not add files to wss instead of filtering the adds.

2) Write a piece of code that performs the cleaning when it is run. Package it as an .exe, perhpas taking some parameters to fine tune the cleanup.
    Then, create a windows scheduled task and run this at appropriate
     time intervals. You could also put the scheduling logic into your code, but Windows does it, so why re-write it.

I would not recommend 1). First, event handlers are fired only in document libraries. Not in lists. So you can only clean up doc libs.
Event handlers are set up per library: you will have to set it up for every single library and every time one library is created, you
will ahve to set up the handler as well. From a practical point of view, event handlers are a little more hard to debug since they run in
the context of the sharepoint server. An exe is far easier to debug.

The scheduled clean up 2) adopts a batch approach. When the server is not used much (at night perhaps) you can then perform the clean up and
when users come in, the site is ready for them.

Thanks,
-Gilles.



Relevant Pages

  • Re: Email sent from sharepoint is not accepted by sharepoint
    ... flawlessly when e-mail is sent to these libraries from an Outlook client. ... ANY e-mail that I have generated from SharePoint ... NOT be accepted by the document libraries. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Email sent from sharepoint is not accepted by sharepoint
    ... What do the logs in the 12 Hive say when SharePoint grabs the messages that fail? ... I have e-mail enabled a number of libraries to accept e-mails, ... flawlessly when e-mail is sent to these libraries from an Outlook client. ... NOT be accepted by the document libraries. ...
    (microsoft.public.sharepoint.windowsservices)
  • Making Content from WSS Site Appear in a Portal Area...
    ... I have a number of Department document libraries and lists in a WSS site ...
    (microsoft.public.sharepoint.portalserver)
  • RE: Making Content from WSS Site Appear in a Portal Area...
    ... > I have a number of Department document libraries and lists in a WSS site ... > libraries and lists and lay them out on the Area page, ...
    (microsoft.public.sharepoint.portalserver)
  • Re: WSS Web Services
    ... > collects is from multiple lists, including document libraries. ... I know how to use the UpdateListItems ...
    (microsoft.public.sharepoint.windowsservices)