/// <summary> /// Create a custom router for a web content organizer /// </summary> /// <param name="web">The web</param> /// <param name="routerName">Router name</param> /// <param name="routerAssemblyName">Router assembly name</param> /// <param name="routerClassName">Router class name in the assembly</param> public void CreateCustomRouter(SPWeb web, string routerName, string routerAssemblyName, string routerClassName) { var contentOrganizer = new EcmDocumentRoutingWeb(web); this.DeleteCustomRouter(web, routerName); contentOrganizer.AddCustomRouter(routerName, routerAssemblyName, routerClassName); }
public override void FeatureActivated(SPFeatureReceiverProperties properties) { using (SPWeb web = GetWeb(properties)) { /* Activate the custom routers for Vendor documents and Work Matter documents */ EcmDocumentRoutingWeb contentOrganizer = new EcmDocumentRoutingWeb(web); try { contentOrganizer.AddCustomRouter(workMatterDocumentsRouterName, workMatterDocumentsRouterAssemblyName, workMatterdocumentsRouterClassName); contentOrganizer.AddCustomRouter(vendorDocumentsRouterName, vendorDocumentsRouterAssemblyName, vendorDocumentsRouterClassName); } catch (Exception ex) { Util.LogError("AddCustomRouter failed with message: " + ex.Message); } } }
/// <summary> /// Registers the custom document router. /// </summary> /// <param name="absoluteSiteURL">The absolute site URL.</param> /// <param name="customRouterName">Name of the custom router.</param> /// <param name="customRouterAssemblyName">Name of the custom router assembly.</param> /// <param name="customRouterClassName">Name of the custom router class.</param> public void RegisterCustomDocumentRouter(string absoluteSiteURL, string customRouterName, string customRouterAssemblyName, string customRouterClassName) { absoluteSiteURL.RequireNotNullOrEmpty("absoluteSiteURL"); customRouterAssemblyName.RequireNotNullOrEmpty("customRouterAssemblyName"); customRouterClassName.RequireNotNullOrEmpty("customRouterClassName"); customRouterName.RequireNotNullOrEmpty("customRouterName"); using (SPSite site = new SPSite(absoluteSiteURL)) using (SPWeb web = site.OpenWeb()) { EcmDocumentRoutingWeb contentOrganizer = new EcmDocumentRoutingWeb(web); contentOrganizer.AddCustomRouter(customRouterName, customRouterAssemblyName, customRouterClassName); } }
/// <summary> /// Creates the router. /// </summary> /// <param name="author">The author.</param> /// <param name="openBinaryStream">The open binary stream.</param> public void CreateRouter(string author, Stream openBinaryStream) { using (SPSite spSite = new SPSite(this.AbsoluteSiteUrl)) using (SPWeb spWeb = spSite.OpenWeb()) { EcmDocumentRoutingWeb ecmDocumentRoutingWeb = new EcmDocumentRoutingWeb(spWeb); try { ecmDocumentRoutingWeb.RemoveCustomRouter(this.RouterName); } catch (Exception e) { UnifiedLoggingServer.LogHigh("EcmDocumentRoutingWeb<" + this.RouterName + "> DEL_ERR:" + e.Message); } UnifiedLoggingServer.LogMedium("---- CRM:ADD_ROUTER"); ecmDocumentRoutingWeb.AddCustomRouter(this.RouterName, this.AssemblyName, this.ClassName); // fetch corresponding folder into corresponding library UnifiedLoggingServer.LogMedium("---- CRM_DestPath=" + this.RouterPath); if (this.HasRouter) { string log = "---- CRM.OnSubmiting\n"; UnifiedLoggingServer.LogMedium("---- CRM.OnSubmiting_DestPath=" + this.RouterPath); this.CustomRouter.OnSubmitFile( ecmDocumentRoutingWeb, this.ContentTypeName, author, openBinaryStream, this.RecordsRepositoryProperties, this.RouterFolder, ref log); UnifiedLoggingServer.LogMedium("---- CRM.OnSubmitted_DestPath=" + this.RouterPath); UnifiedLoggingServer.LogMedium(log); } UnifiedLoggingServer.LogMedium("---- CRM_END_DestPath=" + this.RouterPath); } }
/// <summary> /// Create a custom router for a web content organizer /// </summary> /// <param name="web">The web</param> /// <param name="routerName">Router name</param> /// <param name="routerAssemblyName">Router assembly name</param> /// <param name="routerClassName">Router class name in the assembly</param> public void CreateCustomRouter(SPWeb web, string routerName, string routerAssemblyName, string routerClassName) { var contentOrganizer = new EcmDocumentRoutingWeb(web); DeleteCustomRouter(web, routerName); contentOrganizer.AddCustomRouter(routerName, routerAssemblyName, routerClassName); }