/// <summary>
        /// Initializes a new instance of the <see cref="RecordDocument"/> class.
        /// </summary>
        /// <param name="enabledLibraries">The enabled libraries.</param>
        /// <param name="dropOffListItem">The file sp list item.</param>
        /// <param name="routingRules">The routing rules.</param>
        public RecordDocument(List <SPList> enabledLibraries, SPListItem dropOffListItem, SPListItemCollection routingRules)
        {
            if (enabledLibraries == null)
            {
                throw new ArgumentNullException("enabledLibraries");
            }
            if (dropOffListItem == null)
            {
                throw new ArgumentNullException("dropOffListItem");
            }
            if (routingRules == null)
            {
                throw new ArgumentNullException("routingRules");
            }

            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 3@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + enabledLibraries.Count);
            UnifiedLoggingServer.LogMedium("-@2:" + dropOffListItem.Name);
            UnifiedLoggingServer.LogMedium("-@3:" + routingRules.Count);
            this.ListItem               = dropOffListItem;
            this.File                   = dropOffListItem.File;
            this.FieldCollection        = dropOffListItem.Fields;
            this.ContentType            = dropOffListItem.ContentType;
            this.ParentContentType      = this.GetParentContentType(dropOffListItem.ContentType);
            this.HasRoutingRule         = this.ValidateRoutingRule(routingRules);
            this.HasParentRoutingRule   = this.ScreenForParentRoutingRule(routingRules);
            this.RoutingRule            = this.GetRoutingRule(routingRules);
            this.ParentRoutingRule      = this.GetParentRoutingRule(routingRules);
            this.HasLibrary             = this.ValidateLibrary(enabledLibraries);
            this.HasParentLibrary       = this.ValidateParentLibrary(enabledLibraries);
            this.CandidateLibrary       = this.ScreenForLibrary(enabledLibraries);
            this.ParentCandidateLibrary = this.ScreenForParentLibrary(enabledLibraries);
            this.ScreenMetadata(dropOffListItem.Properties);
        }
        /// <summary>
        /// Traces the log.
        /// </summary>
        /// <param name="header">The header.</param>
        public void TraceLog(string header)
        {
            UnifiedLoggingServer.LogMedium(header + "nam_:" + this.ListItem.Name);
            UnifiedLoggingServer.LogMedium(header + "tit_:" + this.ListItem.Title);
            UnifiedLoggingServer.LogMedium(header + "url_:" + this.ListItem.Url);
            UnifiedLoggingServer.LogMedium(header + "dnm_:" + this.ListItem.DisplayName);
            UnifiedLoggingServer.LogMedium(header + "+++_:" + this.ListItem.ContentType.Name);
            UnifiedLoggingServer.LogMedium(header + "cti_:" + this.ContentTypeId);
            UnifiedLoggingServer.LogMedium(header + "_CT_:" + this.ContentType.Name);
            UnifiedLoggingServer.LogMedium(header + "pCT_:" + this.ParentContentType.Name);
            UnifiedLoggingServer.LogMedium(header + "rul?:" + this.HasRoutingRule);
            UnifiedLoggingServer.LogMedium(header + "lib?:" + this.HasLibrary);

            if (this.HasLibrary)
            {
                UnifiedLoggingServer.LogMedium(header + "lib_:" + this.CandidateLibrary.Title);
                if (this.HasParentLibrary)
                {
                    UnifiedLoggingServer.LogMedium(header + "plb_:" + this.ParentCandidateLibrary.Title);
                }
            }

            if (this.HasRoutingRule)
            {
                UnifiedLoggingServer.LogMedium(header + "rul_:" + this.RoutingRule.Name);
                if (this.HasParentRoutingRule)
                {
                    UnifiedLoggingServer.LogMedium(header + "prl_:" + this.ParentRoutingRule.Name);
                }
            }
        }
        /// <summary>Initializes a new instance of the <see cref="RecordField"/> class.</summary>
        /// <param name="contextSPField">The context sp field.</param>
        /// <param name="fileSPField">The file SP field.</param>
        public RecordField(SPField contextSPField, SPField fileSPField)
        {
            if (contextSPField == null)
            {
                throw new ArgumentNullException("contextSPField");
            }
            if (fileSPField == null)
            {
                throw new ArgumentNullException("fileSPField");
            }

            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 2@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + contextSPField.Title);
            UnifiedLoggingServer.LogMedium("-@2:" + fileSPField.Title);

            // contextual values
            this.ContextSPField = contextSPField;
            this.FileSPField    = fileSPField;

            this.FileSPFieldUser         = fileSPField as SPFieldUser;
            this.SPFieldUserIsMultiValue = this.FileSPFieldUser != null && this.FileSPFieldUser.AllowMultipleValues;

            /*if (this.FileSPFieldUser != null) this.SPFieldUserIsMultiValue = this.FileSPFieldUser.AllowMultipleValues;
             * else this.SPFieldUserIsMultiValue = false;*/

            this.FileSPFieldLookup         = fileSPField as SPFieldLookup;
            this.SPFieldLookupIsMultiValue = this.FileSPFieldLookup != null && this.FileSPFieldLookup.AllowMultipleValues;

            /*if (this.FileSPFieldLookup != null) this.SPFieldLookupIsMultiValue = this.FileSPFieldLookup.AllowMultipleValues;
             * else this.SPFieldLookupIsMultiValue = false;*/

            // initialize SPField tests
            this.InitializeSPFieldTests();
        }
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The tracelog header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "DOLTitle_:" + this.DropOffLibrary.Title);
     UnifiedLoggingServer.LogMedium(header + "LibCount_:" + this.EnabledLibraries.Count);
     UnifiedLoggingServer.LogMedium(header + "RulCount_:" + this.RoutingRules.Count);
     UnifiedLoggingServer.LogMedium(header + "DORDTitl_:" + this.DropOffRecordDocument.Title);
 }
Esempio n. 5
0
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "XLN_Camel_:" + this.CamelCaseName);
     UnifiedLoggingServer.LogMedium(header + "XLN_NCamel:" + this.GetSentenceName());
     UnifiedLoggingServer.LogMedium(header + "XLN_Type__:" + this.Type);
     UnifiedLoggingServer.LogMedium(header + "XLN_Value_:" + this.Value);
 }
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The tracelog header.</param>
 public void TraceLog(string header)
 {
     foreach (SPListItem routingRule in this.RoutingRules)
     {
         UnifiedLoggingServer.LogMedium(header + "Ruls_:" + routingRule.Title);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomRouterManager"/> class.
        /// The custom router manager.
        /// </summary>
        /// <param name="absoluteSiteUrl">The absolute site URL.</param>
        /// <param name="rd">The rd.</param>
        public CustomRouterManager(string absoluteSiteUrl, RecordDocument rd)
        {
            if (String.IsNullOrEmpty(absoluteSiteUrl))
            {
                throw new ArgumentNullException("absoluteSiteUrl");
            }
            if (rd == null)
            {
                throw new ArgumentNullException("rd");
            }

            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 2@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + absoluteSiteUrl);
            UnifiedLoggingServer.LogMedium("-@2:" + rd.File.Name);
            this.AbsoluteSiteUrl             = absoluteSiteUrl;
            this.ContentTypeName             = rd.ContentType.Name;
            this.RouterName                  = rd.ContentType.Name + "CustomRouter";
            this.RecordsRepositoryProperties = this.FetchProperties(rd.FieldCollection, rd.ListItem);
            this.RouterRule                  = this.FetchRule(rd);
            this.RouterPath                  = this.RouterRule.Web.Url + "/";
            this.RouterLibrary               = this.FetchLibrary(rd);
            this.HasRouter       = this.CanFindRouter(rd);
            this.HasTargetFolder = this.RouterRule["Target Folder"] != null;
            this.RouterFolder    = this.FetchFolder();
            this.RouterPath      = this.FetchPath(this.RouterPath);
            this.CustomRouter    = new CustomRouter();
            this.CustomRouter.Initialize(absoluteSiteUrl, rd.File, rd.ContentType.Name);
            this.AssemblyName = this.CustomRouter.AssemblyName;
            this.ClassName    = this.GetType().Namespace + "." + this.CustomRouter.Name;
        }
        /// <summary>
        /// Fetches the properties.
        /// </summary>
        /// <param name="spFieldCollection">The SP field collection.</param>
        /// <param name="listItem">The list item.</param>
        /// <returns>
        /// The Microsoft.SharePoint.RecordsRepositoryProperty[].
        /// </returns>
        private RecordsRepositoryProperty[] FetchProperties(SPFieldCollection spFieldCollection, SPListItem listItem)
        {
            // create a property list/ array for each metadata field
            List <RecordsRepositoryProperty> propertyList = new List <RecordsRepositoryProperty>();

            foreach (SPField spField in spFieldCollection)
            {
                try
                {
                    string value = Convert.ToString(spField.GetFieldValue(Convert.ToString(listItem[spField.Title])));
                    UnifiedLoggingServer.LogMedium("---- CRR_Props[" + spField.Title + "_|_" + spField.TypeAsString + "_|_" + value + "]");
                    RecordsRepositoryProperty property =
                        new RecordsRepositoryProperty
                    {
                        Name  = spField.Title,
                        Type  = spField.TypeAsString,
                        Value = value
                    };

                    propertyList.Add(property);
                }
                catch (Exception e)
                {
                }
            }

            return(propertyList.ToArray());
        }
Esempio n. 9
0
        /// <summary>Initializes a new instance of the <see cref="XmlLookupManager"/> class.</summary>
        /// <param name="xmlProperties">The xml properties.</param>
        public XmlLookupManager(string xmlProperties)
        {
            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 1@ ---");
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xmlProperties);
            xmlDocument.LoadXml(xmlDocument.FirstChild.FirstChild.OuterXml);
            this.LookupNodeList = this.FindXmlLookups(xmlDocument.DocumentElement);
        }
Esempio n. 10
0
        /// <summary>Initializes a new instance of the <see cref="XmlLookupReader"/> class.</summary>
        /// <param name="xmlProperties">The xml properties.</param>
        public XmlLookupReader(string xmlProperties)
        {
            UnifiedLoggingServer.LogMedium("---- XmlLookupReader(" + xmlProperties + ")");
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xmlProperties);
            xmlDocument.LoadXml(xmlDocument.FirstChild.FirstChild.OuterXml);
            this.LookupNodeList = this.FindXmlLookups(xmlDocument.DocumentElement);
        }
Esempio n. 11
0
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "DoLurl_:" + this.DropOffLibUrl);
     UnifiedLoggingServer.LogMedium(header + "DoLtit_:" + this.DropOffLibTitle);
     UnifiedLoggingServer.LogMedium(header + "DoLsnd_:" + this.DropOffLibrary.SendToLocationUrl);
     foreach (SPList enabledLibrary in this.EnabledLibraries)
     {
         UnifiedLoggingServer.LogMedium(header + "Libs_:" + enabledLibrary.Title);
     }
 }
        /// <summary>Initializes a new instance of the <see cref="RoutingRulesManager"/> class.</summary>
        /// <param name="url">The URL.</param>
        public RoutingRulesManager(string url)
        {
            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 1@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + url);

            url += "/" + RoutingRulesTitle;
            using (SPSite spSite = new SPSite(url))
                using (SPWeb spWeb = spSite.OpenWeb())
                    this.RoutingRules = this.ScanForCustomOrganizerRules(spWeb.Lists);
        }
Esempio n. 13
0
        /// <summary>
        /// Scans the fields.
        /// </summary>
        /// <param name="dropOffLibrary">The drop off library.</param>
        /// <param name="dropOffLibraryUrl">The drop off library URL.</param>
        public void ScanFields(SPList dropOffLibrary, string dropOffLibraryUrl)
        {
            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + ".ScanFields 2@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + dropOffLibrary.Title);
            UnifiedLoggingServer.LogMedium("-@2:" + dropOffLibraryUrl);

            // rd.SpListItem, rlm.DropOffLibrary, rlm.DropOffLibUrl, rd.XmlProperties
            RecordFieldManager rfm = new RecordFieldManager(
                this.RecordDocument.ListItem, dropOffLibrary, dropOffLibraryUrl, this.RecordDocument.XmlProperties, false);

            rfm.TraceLog("TraceLog_RFM_");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RecordCentreManager"/> class.
        /// </summary>
        /// <param name="dropOffListItem">The SP List Item corresponding the one in the Drop Off Library.</param>
        /// <param name="url">The URL.</param>
        public RecordCentreManager(SPListItem dropOffListItem, string url)
        {
            if (dropOffListItem == null)
            {
                throw new ArgumentNullException("dropOffListItem");
            }
            if (String.IsNullOrEmpty(url))
            {
                throw new ArgumentException("url");
            }

            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 2@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + dropOffListItem.Name);
            UnifiedLoggingServer.LogMedium("-@2:" + url);

            using (RecordLibraryManager rlm = new RecordLibraryManager(url))
                using (RoutingRulesManager rrm = new RoutingRulesManager(url))
                {
                    rlm.TraceLog("TraceLog_RLM_");
                    rrm.TraceLog("TraceLog_RRM_");

                    this.EnabledLibraries = rlm.EnabledLibraries;

                    this.DropOffLibrary = rlm.DropOffLibrary;
                    this.RoutingRules   = rrm.RoutingRules;

                    using (RecordDocumentManager rdm =
                               new RecordDocumentManager(
                                   dropOffListItem, rlm.EnabledLibraries, rrm.RoutingRules))
                    {
                        this.DropOffRecordDocument = rdm.RecordDocument;

                        rdm.ScanFields(rlm.DropOffLibrary, rlm.DropOffLibUrl);

                        /* trying to find a better ways:
                         * adding rules to rule list
                         * adding custom router implementing IRouter
                         * instead of forcing the copy
                         * rdm.MoveFileToLibrary();*/
                        rdm.TraceLog("TraceLog_RDM_");
                        this.DropOffRecordDocument.TraceLog("TraceLog_RD_");

                        using (CustomRouterManager crm = new CustomRouterManager(url, this.DropOffRecordDocument))
                        {
                            crm.CreateRouter(
                                this.DropOffRecordDocument.Author,
                                this.DropOffRecordDocument.File.OpenBinaryStream(SPOpenBinaryOptions.Unprotected));
                            crm.TraceLog("TraceLog_CRM_");
                        }
                    }
                }
        }
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "IsFdTxt|Chce:" + this.SPFieldTypeIsTextOrChoice);
     UnifiedLoggingServer.LogMedium(header + "IsFdNumber__:" + this.SPFieldTypeIsNumber);
     UnifiedLoggingServer.LogMedium(header + "IsFdSameUser:"******"IsFdUser____:" + this.SPFieldTypeIsUser);
     UnifiedLoggingServer.LogMedium(header + "IsFdLookup__:" + this.SPFieldTypeIsLookup);
     UnifiedLoggingServer.LogMedium(header + "IsFdLUp|Invd:" + this.SPFieldTypeIsLookupOrInvalid);
     UnifiedLoggingServer.LogMedium(header + "IsFdDateTime:" + this.SPFieldTypeIsDateTime);
     UnifiedLoggingServer.LogMedium(header + "IsFdTaxonomy:" + this.SPFieldIsTaxonomy);
     UnifiedLoggingServer.LogMedium(header + "IsFdUsrMulti:" + this.SPFieldUserIsMultiValue);
     UnifiedLoggingServer.LogMedium(header + "IsFdLkpMulti:" + this.SPFieldLookupIsMultiValue);
 }
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The tracelog header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "AbsUrl_:" + this.AbsoluteSiteUrl);
     UnifiedLoggingServer.LogMedium(header + "RteNam_:" + this.RouterName);
     UnifiedLoggingServer.LogMedium(header + "PropSz_:" + this.RecordsRepositoryProperties.Length);
     UnifiedLoggingServer.LogMedium(header + "RleNam_:" + this.RouterRule.Name);
     UnifiedLoggingServer.LogMedium(header + "DesPat_:" + this.RouterPath);
     UnifiedLoggingServer.LogMedium(header + "LibTit_:" + this.RouterLibrary.Title);
     UnifiedLoggingServer.LogMedium(header + "HasRte_:" + this.HasRouter);
     UnifiedLoggingServer.LogMedium(header + "HasTgF_:" + this.HasTargetFolder);
     UnifiedLoggingServer.LogMedium(header + "AssNam_:" + this.AssemblyName);
     UnifiedLoggingServer.LogMedium(header + "ClasNm_:" + this.ClassName);
 }
Esempio n. 17
0
 /// <summary>Initializes a new instance of the <see cref="RecordLibraryManager"/> class.</summary>
 /// <param name="url">The URL.</param>
 public RecordLibraryManager(string url)
 {
     UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 1@ ---");
     UnifiedLoggingServer.LogMedium("-@1:" + url);
     using (SPSite spSite = new SPSite(url))
         using (SPWeb spWeb = spSite.OpenWeb())
         {
             spWeb.AllowUnsafeUpdates = true;
             EcmDocumentRoutingWeb edrw = new EcmDocumentRoutingWeb(spWeb);
             this.DropOffLibUrl    = edrw.DropOffZoneUrl;
             this.DropOffLibTitle  = edrw.DropOffZone.Title;
             this.DropOffLibrary   = spWeb.Lists.TryGetList(edrw.DropOffZone.Title);
             this.EnabledLibraries = this.ScreenLibraries(spWeb);
         }
 }
        /// <summary>
        /// Initializes the specified absolute site URL.
        /// </summary>
        /// <param name="absoluteSiteUrl">The absolute site URL.</param>
        /// <param name="recordFile">The record file.</param>
        /// <param name="contentTypeName">Name of the content type.</param>
        public void Initialize(string absoluteSiteUrl, SPFile recordFile, string contentTypeName)
        {
            if (String.IsNullOrEmpty(absoluteSiteUrl))
            {
                throw new ArgumentNullException("absoluteSiteUrl");
            }
            if (recordFile == null)
            {
                throw new ArgumentNullException("recordFile");
            }
            if (String.IsNullOrEmpty(contentTypeName))
            {
                throw new ArgumentNullException("contentTypeName");
            }

            string s = "--- " + this.GetType().Name + " 3@ ---";

            this.log += s + "\n";
            UnifiedLoggingServer.LogMedium(s);
            s         = "-@1:" + recordFile.Name;
            this.log += s + "\n";
            UnifiedLoggingServer.LogMedium(s);
            s         = "-@2:" + absoluteSiteUrl;
            this.log += s + "\n";
            UnifiedLoggingServer.LogMedium(s);
            s         = "-@3:" + contentTypeName;
            this.log += s + "\n";
            UnifiedLoggingServer.LogMedium(s);

            this.AssemblyName = this.GetType().Assembly.FullName;
            this.log         += "--- CR.Init:" + this.AssemblyName + "\n";
            UnifiedLoggingServer.LogMedium("--- CR.Init:" + this.AssemblyName);
            this.Name = this.GetType().Name;
            this.log += "--- CR.Init:" + this.Name + "\n";
            UnifiedLoggingServer.LogMedium("--- CR.Init:" + this.Name);
            this.FileName = recordFile.Name;
            this.log     += "--- CR.Init:" + this.FileName + "\n";
            UnifiedLoggingServer.LogMedium("--- CR.Init:" + this.FileName);
            this.FilePath = absoluteSiteUrl + "/" + recordFile.Url;
            this.log     += "--- CR.Init:" + this.FilePath + "\n";
            UnifiedLoggingServer.LogMedium("--- CR.Init:" + this.FilePath);
            this.ContentType = contentTypeName;
            this.log        += "--- CR.Init:" + this.ContentType + "\n";
            UnifiedLoggingServer.LogMedium("--- CR.Init:" + this.ContentType);
            this.SpUser = new SPSite(absoluteSiteUrl).OpenWeb().CurrentUser;
            this.log   += "--- CR.Init:" + this.SpUser.Name + "\n";
            UnifiedLoggingServer.LogMedium("--- CR.Init:" + this.SpUser.Name);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RecordFieldManager"/> class.
        /// </summary>
        /// <param name="fileSpListItem">The file sp list item.</param>
        /// <param name="contextLibraryList">The contextual library list.</param>
        /// <param name="url">The URL.</param>
        /// <param name="xmlLookup">The XML lookup.</param>
        /// <param name="changeVersion">if set to <c>true</c> [change version].</param>
        public RecordFieldManager(
            SPListItem fileSpListItem, SPList contextLibraryList, string url, string xmlLookup, bool changeVersion)
        {
            if (fileSpListItem == null)
            {
                throw new ArgumentNullException("fileSpListItem");
            }
            if (contextLibraryList == null)
            {
                throw new ArgumentNullException("contextLibraryList");
            }
            if (String.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException("url");
            }
            if (new SPSite(url) == null)
            {
                throw new SPException(url + " Invalid Url");
            }
            if (String.IsNullOrEmpty(xmlLookup))
            {
                throw new ArgumentNullException("xmlLookup");
            }

            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 5@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + fileSpListItem.Name);
            UnifiedLoggingServer.LogMedium("-@2:" + contextLibraryList.Title);
            UnifiedLoggingServer.LogMedium("-@3:" + url);
            UnifiedLoggingServer.LogMedium("-@4:" + xmlLookup.Length);
            UnifiedLoggingServer.LogMedium("-@5:" + changeVersion);
            this.FileListItem    = fileSpListItem;
            this.ContextUrl      = url;
            this.ContextListName = url.Split('/')[url.Split('/').Length - 2];
            this.ContextSite     = new SPSite(url);
            this.ContextWeb      = this.ContextSite.OpenWeb();
            this.ContextFields   = contextLibraryList.Fields;
            this.ChangeVersion   = changeVersion;

            // disable the security validation (temporarily)
            this.ContextSite.RootWeb.AllowUnsafeUpdates = true;

            // Screen source item
            this.ScreenXMLLookup(xmlLookup);

            // Screen for new field from XML Lookup
            // this.AddUnmatchedLookups(fileSpListItem);
        }
        /// <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. 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RecordDocumentManager"/> class.
        /// </summary>
        /// <param name="dropOffListItem">The drop off library record.</param>
        /// <param name="enabledLibraries">The SP web lists.</param>
        /// <param name="routingRules">The routing rules.</param>
        public RecordDocumentManager(
            SPListItem dropOffListItem, List <SPList> enabledLibraries, SPListItemCollection routingRules)
        {
            if (dropOffListItem == null)
            {
                throw new ArgumentNullException("dropOffListItem");
            }
            if (enabledLibraries == null)
            {
                throw new ArgumentException("enabledLibraries");
            }
            if (routingRules == null)
            {
                throw new ArgumentNullException("routingRules");
            }

            UnifiedLoggingServer.LogMedium("--- " + this.GetType().Name + " 3@ ---");
            UnifiedLoggingServer.LogMedium("-@1:" + dropOffListItem.Name);
            UnifiedLoggingServer.LogMedium("-@2:" + enabledLibraries.Count);
            UnifiedLoggingServer.LogMedium("-@3:" + routingRules.Count);
            this.RecordDocument = new RecordDocument(enabledLibraries, dropOffListItem, routingRules);
        }
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "Flds_" + this.ToString(true));
 }
Esempio n. 23
0
 /// <summary>
 /// Traces the log.
 /// </summary>
 public void TraceLog()
 {
     UnifiedLoggingServer.LogMedium("---- XmlLookupReader ----");
     UnifiedLoggingServer.LogMedium("TraceLog_XmlLReader_" + this.LookupNodeMatched.GetSentenceName());
     UnifiedLoggingServer.LogMedium("TraceLog_XmlLReader_" + this.LookupNodeList.Count);
 }
Esempio n. 24
0
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "XLM_ListCount_:" + this.LookupNodeList.Count);
 }
        // CustomRouterResult ICustomRouter.OnSubmitFile(
        // public CustomRouterResult OnSubmitFile(
        /// <summary>
        /// The on submit file.
        /// </summary>
        /// <param name="contentOrganizerWeb">The content organizer web.</param>
        /// <param name="recordSeries">The record series.</param>
        /// <param name="userName">The user name.</param>
        /// <param name="fileContent">The file content.</param>
        /// <param name="properties">The properties.</param>
        /// <param name="finalFolder">The final folder.</param>
        /// <param name="resultDetails">The result details.</param>
        /// <returns>
        /// The Microsoft.Office.RecordsManagement.RecordsRepository.CustomRouterResult.
        /// </returns>
        public CustomRouterResult OnSubmitFile(
            EcmDocumentRoutingWeb contentOrganizerWeb,
            string recordSeries,
            string userName,
            Stream fileContent,
            RecordsRepositoryProperty[] properties,
            SPFolder finalFolder,
            ref string resultDetails)
        {
            if (contentOrganizerWeb == null)
            {
                throw new ArgumentNullException("contentOrganizerWeb");
            }

            // We should have a Content Organizer enabled web
            if (!contentOrganizerWeb.IsRoutingEnabled)
            {
                throw new ArgumentException("Invalid content organizer.");
            }
            if (String.IsNullOrEmpty(recordSeries))
            {
                throw new ArgumentNullException("recordSeries");
            }
            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentNullException("userName");
            }
            if (fileContent.Length == 0)
            {
                throw new ArgumentNullException("fileContent");
            }
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }
            if (!finalFolder.Exists)
            {
                throw new ArgumentNullException("finalFolder");
            }

            UnifiedLoggingServer.LogMedium("---- CR.OnSubmitFile() 7@");
            UnifiedLoggingServer.LogMedium("-@1:" + contentOrganizerWeb.GetType());
            UnifiedLoggingServer.LogMedium("-@2:" + recordSeries);
            UnifiedLoggingServer.LogMedium("-@3:" + userName);
            UnifiedLoggingServer.LogMedium("-@4:" + fileContent.Length);
            UnifiedLoggingServer.LogMedium("-@5:" + properties.Length);
            UnifiedLoggingServer.LogMedium("-@6:" + finalFolder.Name);
            UnifiedLoggingServer.LogMedium("-@7:" + resultDetails);

            try
            {
                foreach (RecordsRepositoryProperty recordsRepositoryProperty in properties)
                {
                    string s = "---- CR.Props [" + recordsRepositoryProperty.Name + "|"
                               + recordsRepositoryProperty.Value + "]";
                    this.log += s + "\n";
                    UnifiedLoggingServer.LogMedium(s);
                }

                // Create a Hashtable of properties which forms the metadata for the file
                Hashtable fileProperties = EcmDocumentRouter.GetHashtableForRecordsRepositoryProperties(properties, recordSeries);
                UnifiedLoggingServer.LogMedium("---- CR.OnSubmitFile().GetHashtableForRecordsRepositoryProperties:" + fileProperties.Count);
                resultDetails += this.log;
                UnifiedLoggingServer.LogMedium("-@FilNm_:" + this.FileName);
                UnifiedLoggingServer.LogMedium("-@FilPt_:" + this.FilePath);
                UnifiedLoggingServer.LogMedium("-@SPusr_:" + this.SpUser);

                // Save it to disk
                EcmDocumentRouter.SaveFileToFinalLocation(
                    contentOrganizerWeb,
                    finalFolder,
                    fileContent,
                    this.FileName,
                    this.FilePath,
                    fileProperties,
                    this.SpUser,
                    true,
                    "CustomRouter CheckInComment");
            }
            catch (Exception e)
            {
                UnifiedLoggingServer.LogHigh("---- CR:TryCatch savefiletofinallocation" + e.Message);
                return(CustomRouterResult.SuccessCancelFurtherProcessing);
            }

            return(CustomRouterResult.SuccessContinueProcessing);
        }
Esempio n. 26
0
 /// <summary>
 /// Traces the log.
 /// </summary>
 /// <param name="header">The trace log header.</param>
 public void TraceLog(string header)
 {
     UnifiedLoggingServer.LogMedium(header + "Name_:" + this.RecordDocument.File.Name);
     UnifiedLoggingServer.LogMedium(header + "Titl_:" + this.RecordDocument.Title);
     UnifiedLoggingServer.LogMedium(header + "DNam_:" + this.RecordDocument.ListItem.DisplayName);
 }