public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
 {
     using (SPWeb web = GetWeb(properties))
     {
         /* Deactivate the custom routers for Vendor documents and Work Matter documents */
         EcmDocumentRoutingWeb contentOrganizer = new EcmDocumentRoutingWeb(web);
         try
         {
             contentOrganizer.RemoveCustomRouter(workMatterDocumentsRouterName);
             contentOrganizer.RemoveCustomRouter(vendorDocumentsRouterName);
         }
         catch (Exception ex)
         {
             Util.LogError("RemoveCustomRouter failed with message: " + ex.Message);
         }
     }
 }
        /// <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);
                }
        }
Esempio n. 3
0
        /// <summary>
        /// Delete a custom router
        /// </summary>
        /// <param name="web">The web</param>
        /// <param name="routerName">The router name</param>
        public void DeleteCustomRouter(SPWeb web, string routerName)
        {
            var contentOrganizer = new EcmDocumentRoutingWeb(web);

            contentOrganizer.RemoveCustomRouter(routerName);
        }
 /// <summary>
 /// Delete a custom router
 /// </summary>
 /// <param name="web">The web</param>
 /// <param name="routerName">The router name</param>
 public void DeleteCustomRouter(SPWeb web, string routerName)
 {
     var contentOrganizer = new EcmDocumentRoutingWeb(web);
     contentOrganizer.RemoveCustomRouter(routerName);
 }