Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In our application we use the content organizer to re-route incoming documents. We have set the timerjob Content Organizer Processing on 1 minute for fast processing. However users now get every minute an email when a document is not ready and need more information.

Is there a way that a document is automatically routed on saving the document without setting the timerjob settings on 1 minute?

share|improve this question
    
Solved my problem. Problem was a custom field. This field override the SPContext.Current.FormContext.OnSaveHandler eventhandler. Now the documents are instantly routed onsave and the timerjob is set run 2 a day. –  Remko May 19 '11 at 12:31
add comment

1 Answer 1

The only thing I could think of is to add an item event receiver to your document library. When a new document gets added, start the Content Organizer Processing timer job manually.

public class EventReceiver1 : SPItemEventReceiver
{
    public override void ItemAdded(SPItemEventProperties properties)
    {
        using(SPSite site = new SPSite(properties.SiteId))
        {
            site.WebApplication.JobDefinitions["RouterProcessingJob"].RunNow();
        }
    }
}

Alternatively, you could route the file yourself

public class EventReceiver1 : SPItemEventReceiver
{
    public override void ItemAdded(SPItemEventProperties properties)
    {
        EcmDocumentRoutingWeb contentOrganizerWeb = new EcmDocumentRoutingWeb(properties.Web);
        if (!contentOrganizerWeb.IsRoutingEnabled)
            return;

        string finalDestination;
        bool wasRoutedToOtherSite;
        contentOrganizerWeb.Router.RouteFileToFinalDestination(properties.ListItem, out finalDestination, out wasRoutedToOtherSite);    
    }
}

However, these may not be ideal because they would require you to add the receiver to every document library.

Reference: http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouter.aspx

share|improve this answer
    
I am getting an error on contentOrganizerWeb.Router.RouteFileToFinalDestination(properties.ListItem, out finalDestination, out wasRoutedToOtherSite); –  Remko May 17 '11 at 14:40
    
I did not have the time to set up an environment and test that. I think that you could explore doing the routing yourself through a receiver though. It may take some work to get it functioning. What was the error message by the way? –  Matt Weimer May 17 '11 at 18:05
    
I am getting Object reference not set to an instance of an object at Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouter.RouteFile‌​ToFinalDestination(SPListItem itemToRoute, String& finalDestination, Boolean& wasRoutedToOtherSite) at CZ.SharePoint.ContentOrganizerReceiver.RunContentOrganizer.<>c__DisplayClass1.<It‌​emUpdated>b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2‌​() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) –  Remko May 18 '11 at 7:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.