public async System.Threading.Tasks.Task <IList <RecordDocument> > Get() { string userUPN = await GetUser(); List <RecordDocument> records = new List <RecordDocument>(); using (Database db = getDatabase(userUPN)) { TrimMainObjectSearch search = new TrimMainObjectSearch(db, BaseObjectTypes.Record); search.SetSearchString("recExtension:docx"); //TrimSearchClause clause = new TrimSearchClause(db, BaseObjectTypes.Record, SearchClauseIds.Favorite); //search.AddSearchClause(clause); //TrimSearchClause extClause = new TrimSearchClause(db, BaseObjectTypes.Record, SearchClauseIds.RecordExtension); //extClause.SetCriteriaFromString("docx"); //search.AddSearchClause(extClause); //search.And(); foreach (Record record in search) { records.Add(new RecordDocument(record)); } return(records); } }
private static void CreateRMRecord(FileInfo f) { // msg. //LoadMessage(@"C:\Docs\TestMail.eml"); var strmessageId = findmessagid(f); //Console.WriteLine("message id: " + strmessageId); using (Database db = new Database()) { db.Connect(); TrimMainObjectSearch objs = new TrimMainObjectSearch(db, BaseObjectTypes.Record); //objs.SetSearchString("messageId = " + strmessageId); objs.SetSearchString("messageId= *[email protected]*"); if(objs.FastCount>0) { Console.WriteLine("Found a record with the same message ID"); } else { Console.WriteLine("Did not find a message id"); } //RecordType rt = new RecordType(db,3); //Record r = new Record(rt); //r.Container = new Record(db, 172693); //r.Title = f.Name; //r.Save(); //Console.WriteLine("New RM email record: " + r.Number); //Record r = new Record(db, 172736); } }
static void Main(string[] args) { TrimApplication.Initialize(); using (Database db = new Database()) { TrimMainObjectSearch objS = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objS.SetSearchString(""); } }
public IEnumerable<RecordData> RetrieveRecords(DateTime lastUpdated) { Logger.InfoFormat("Retrieving records from {0:dd/MM/yyyy h:mm tt}", lastUpdated); using (var records = new TrimMainObjectSearch(Db, BaseObjectTypes.Record)) { /* records.SetSearchString(@"acl:""View Document"",[""INTEL-INVEST""]"); records.And(); var trimSearchClause = new TrimSearchClause(BaseObjectTypes.Record, Db, SearchClauseIds.Updated); trimSearchClause.SetCriteriaFromDateComparison(ComparisonType.GreaterThanOrEqualTo, new TrimDateTime(lastUpdated)); records.AddSearchClause(trimSearchClause); records.And(); var extensionSearchClause = new TrimSearchClause(BaseObjectTypes.Record, Db, SearchClauseIds.RecordExtension); extensionSearchClause.SetCriteriaFromString("*"); records.AddSearchClause(extensionSearchClause); records.SetFilterString("type:document"); */ records.SetSearchString(String.Format(@"acl:""View Document"",[""INTEL-INVEST""] and type:document and extension: * and updated >= {0:dd/MM/yyyy h:mm tt} and not (disposition:Inactive,Destroyed)", lastUpdated)); records.AddSortItemAscending(SearchClauseIds.Updated); int recordsReturned = 0; foreach (Record resultRecord in records) { Logger.DebugFormat("{0:dd MMM yyyy HH:mm:ss} - {1}", resultRecord.LastUpdatedOn.ToDateTime(), resultRecord.NameString); var data = new RecordData {RecordNumber = resultRecord.Uri}; data.Metadata.Add("name", resultRecord.NameString); if (!String.IsNullOrEmpty(resultRecord.Notes)) { data.Metadata.Add("notes", resultRecord.Notes); } using (ExtractDocument extractDocument = resultRecord.GetExtractDocument()) { data.Metadata.Add("filename", extractDocument.FileName); } data.Acls = RetrieveSecurity(resultRecord).ToList(); yield return data; if (++recordsReturned == 100) { Logger.Info("Returning only 100 records"); LastRecordUpdatedDate = resultRecord.LastUpdatedOn.ToDateTime(); yield break; } } } }
private static void TestSearch(Database database) { TrimMainObjectSearch search = new TrimMainObjectSearch(database, BaseObjectTypes.Record); search.SetSearchString("recElectronic"); FieldDefinition speadField = new FieldDefinition(database, "Speed"); foreach (Record record in search) { Console.WriteLine($"Uri: {record.Uri}, Title: {record.Title}, Owner: {record.OwnerLocation.NameString}, Speed: {getField(speadField, record)}"); } }
public IEnumerator <Record> GetEnumerator() { search = new TrimMainObjectSearch(database, BaseObjectTypes.Record); search.SetSearchString(_query); search.PagingMode = true; search.LimitOnRowsReturned = limitOnRowsReturned; search.SkipCount = skipCount; foreach (Record record in search) { yield return(record); } }
private void Origin_Chooser_Button_Click(object sender, RoutedEventArgs e) { // First filter the Origins to select from and then allow the user to choose an Origin TrimMainObjectSearch search = new TrimMainObjectSearch(Database, BaseObjectTypes.Origin); search.SetSearchString(string.Format("ognType:{0}", OriginType.WindowsFolder)); SelectedOrigin = ObjectSelector.SelectOne(GetDesktopWindow(), search) as Origin; if (string.IsNullOrEmpty(SourceFolder)) { SourceFolder = SelectedOrigin.OriginLocation; } }
private static void TestStreamSearch(Database database) { TrimMainObjectSearch search = new TrimMainObjectSearch(database, BaseObjectTypes.Record); search.SetSearchString("recElectronic"); TrimSearchDataStream searchStream = search.GetDataStream(new PropertyOrFieldDefList() { new PropertyOrFieldDef(PropertyIds.RecordOwnerLocation, database), new PropertyOrFieldDef(new FieldDefinition(database, "Speed")), new PropertyOrFieldDef(PropertyIds.RecordTitle, database) }); while (searchStream.MoveNext()) { var searchItem = searchStream.Current(); Console.WriteLine(searchItem.GetAsJSONString()); } }
private static int nextnumber() { TrimApplication.Initialize(); using (Database db = new Database()) { int intChildCnt = 0; int intChildLast = 0; List<int> classNumb = new List<int>(); List<Classification> cl = new List<Classification>(); TrimMainObjectSearch obj = new TrimMainObjectSearch(db, BaseObjectTypes.Classification); obj.SetSearchString("parent:" + 9144); obj.SetSortString("numberx"); int icnt = 1; if (obj.FastCount > 0) { foreach (Classification c in obj) { if (icnt > 98) { var sdsd = icnt; } cl.Add(c); var sdsdsd = c.LevelNumberUncompressed; var kkkk = c.LevelNumberUncompressed.Remove(0, 1); classNumb.Add(Convert.ToInt32(kkkk)); icnt++; } //classNumb.Sort(x=>x) //cl.Max(x => x.Uri); intChildCnt = classNumb.Max(); intChildLast = classNumb.Last(); } else { intChildCnt = 0; } Console.WriteLine(" Container count: " + obj.FastCount.ToString() + " Max number: " + (intChildCnt + 10).ToString() + " Last number: " + (intChildLast + 10).ToString()); return intChildLast + 10; } }
private static Record GetFolderUri(string p1, string p2, Database db) { Record r = null; Classification c = (Classification)db.FindTrimObjectByName(BaseObjectTypes.Classification, "zz Legacy T1 ECM - Business Folders - " + p1); if(c!=null) { TrimMainObjectSearch mso = new TrimMainObjectSearch(db, BaseObjectTypes.Record); //string ss = "title:" + reader.GetString(7) + " and classification:zz Legacy T1 ECM - Business Folders - " + reader.GetString(6); mso.SetSearchString("classification:"+c.Uri); foreach(Record rec in mso) { if(rec.Title==p2) { r = rec; } } } return r; }
static void Main(string[] args) { using (Database db = new Database()) { TrimMainObjectSearch objs = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objs.SetSearchString("type:16 and not ECMSTDJobNo:\"\""); //type:16 and not ECMSTDJobNo:"" //ECMInfringementInfringementID: FieldDefinition fdFrom = new FieldDefinition(db, 91); FieldDefinition fdTo = new FieldDefinition(db, 510); foreach (Record r in objs) { Console.WriteLine("Record: {0}", r.Uri.ToString()); string iFrom = (string)r.GetFieldValue(fdFrom).ToDotNetObject(); string iTo = (string)r.GetFieldValue(fdTo).ToDotNetObject(); if(string.IsNullOrWhiteSpace(iTo)) { try { if (r.DateRegistered <= r.DateReceived) { //If the date registered and date recieved are in the wrong order RM gets cranky. we check and save if needed, this is a data vallidation issue from the migration. DateTime tdtDateReceived = r.DateReceived; r.DateRegistered = (TrimDateTime)tdtDateReceived.AddHours(1); r.Save(); Console.WriteLine("Record date registered updated"); } r.SetFieldValue(fdTo, new UserFieldValue(Convert.ToString(iFrom))); r.Save(); Console.WriteLine("Record UDF field updated"); } catch (Exception exp) { Console.WriteLine("Error: {0}",exp.Message.ToString()); } } } } }
static void Main(string[] args) { int iCount = 0; TrimApplication.Initialize(); using (Database db = new Database()) { Console.WriteLine("Change date recieved: Y/N"); string dr = Console.ReadLine(); TrimMainObjectSearch objS = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objS.SetSearchString("type:16"); foreach(Record r in objS) { if (r.DateRegistered <= r.DateReceived) { iCount++; Console.WriteLine("Record with a date issue: " + r.Number); if (dr == "Y") { //if (r.Number == "805639") //{ r.DateReceived = r.DateRegistered; //DateTime tdtDateReceived = reccheck.DateReceived; //reccheck.DateRegistered = (TrimDateTime)tdtDateReceived.AddHours(1); try { r.Save(); Console.WriteLine("Changed ok"); } catch (Exception exp) { Console.WriteLine("Error: " + exp.Message.ToString()); } //} } } } } Console.WriteLine("Date issue count: " + iCount.ToString()); }
private void Button_Click(object sender, RoutedEventArgs e) { using (Database database = new Database()) { database.Id = _databaseId; database.Connect(); TrimMainObjectSearch search = new TrimMainObjectSearch(database, BaseObjectTypes.Record); search.SetSearchString(string.Format("unkUri: {0}", _recordUris)); string msg = string.Empty; foreach (Record record in search) { msg += record.Title + "\n"; } MessageBox.Show(msg, "Record Titles"); } // ((App)Application.Current) }
private static int FindStartingNumber(long toplevelUri, Database db) { int intChildCnt = 0; List<int> classNumb = new List<int>(); TrimMainObjectSearch obj = new TrimMainObjectSearch(db, BaseObjectTypes.Classification); obj.SetSearchString("parent:" + toplevelUri); if (obj.FastCount > 0) { foreach (Classification c in obj) { var kkkk = c.LevelNumberUncompressed.Remove(0, 2); classNumb.Add(Convert.ToInt32(kkkk)); } intChildCnt = classNumb.Max(); } else { intChildCnt = 0; } return intChildCnt + 10; }
private static Record GetFolderUri(string function, string activity, Database db) { Record r = null; //For tfr to SCC //zz legacy T1 ECM - Business Folders - Information Management - Projects //Local //zz Legacy T1 ECM - Business Folders string ClassSearch = "zz legacy T1 ECM - Business Folders - " + function; Classification c = (Classification)db.FindTrimObjectByName(BaseObjectTypes.Classification, "zz legacy T1 ECM - Business Folders - " + function); if (c != null) { TrimMainObjectSearch mso = new TrimMainObjectSearch(db, BaseObjectTypes.Record); //string ss = "title:" + reader.GetString(7) + " and classification:zz Legacy T1 ECM - Business Folders - " + reader.GetString(6); mso.SetSearchString("classification:" + c.Uri); foreach (Record rec in mso) { if (rec.Title == activity) { r = rec; } } } return r; }
private static int FindStartingNumber(long toplevelUri, Database db) { int intChildLast = 0; List<int> classNumb = new List<int>(); List<Classification> cl = new List<Classification>(); TrimMainObjectSearch obj = new TrimMainObjectSearch(db, BaseObjectTypes.Classification); obj.SetSearchString("parent:" + toplevelUri); obj.SetSortString("uri"); if (obj.FastCount > 0) { foreach (Classification c in obj) { cl.Add(c); var kkkk = c.LevelNumberUncompressed.Remove(0, 1); classNumb.Add(Convert.ToInt32(kkkk)); } intChildLast= classNumb.Last(); } Console.WriteLine("Calculating next folder number: "+toplevelUri.ToString()+" Container count: "+obj.FastCount.ToString()+ " Last number: "+(intChildLast+10).ToString()); return intChildLast + 10; }
private static Record CheckSubFolderAlreadyExists(long folder, string p, Database db) { Record rec = null; TrimMainObjectSearch objS = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objS.SetSearchString("container:" + folder); foreach (Record r in objS) { if (r.Title == p.Trim()) { rec = r; } } return rec; }
private static Record CheckifFolderAlreadyExists(Classification cl3, string p, Database db) { Record rec = null; TrimMainObjectSearch objS = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objS.SetSearchString("classification:" + cl3.Uri); foreach (Record r in objS) { if (r.Title == p.Trim()) { rec = r; } } return rec; }
static void Main(string[] args) { using (Database db = new Database()) { TrimMainObjectSearch objs = new TrimMainObjectSearch(db, BaseObjectTypes.Record); //792378 //First check to see if anything comes back //With more time this search should have been defined into manageable chunks objs.SetSearchString("type:16"); //Limit to the record type that I know is relevent //Initial attempts to manage the chunk runs //Console.WriteLine("Enter row limit"); //objs.LimitOnRowsReturned = Convert.ToInt64(Console.ReadLine()); // limit to 1000 out of 3.6 mill //Console.WriteLine("Enter row skip"); //objs.SkipCount = Convert.ToInt64(Console.ReadLine()); //objs.SetSearchString("number:792378"); //Changed to grab the entire set as an array of record uri's, so I can manage this in chunks by using a skip and take. Tried the RM Limitonrowsreturns and skipcount but I wasnt confident that it was working properly. Not enough time to invetigate and confirm. Each record type return is 3.6 mill records. long[] auri = objs.GetResultAsUriArray(); //db.FindTrimObjectByUri(BaseObjectTypes.fi) FieldDefinition fdNotes = new FieldDefinition(db, 42); var iCount = 0; var iTotal = objs.FastCount; //Im changing this for each compile and moving it to a prod WG server to run, doing 4 at a time which takes about 3 hours. 1 mill over 3 hours. foreach(var lUri in auri.Skip(1826354).Take(23646)) { //find the record from the looped uri try { Record rec = (Record)db.FindTrimObjectByUri(BaseObjectTypes.Record, lUri); if (rec != null) { iCount++; //Grab notes from the user defined field var sNotes = rec.GetFieldValue(fdNotes).ToString(); //grab the normal record system notes var sExistingNotes = rec.Notes; //Check for and exclude the custom notes field if empty, it would be nice if I could do this search as part of the original setsearchstring as about 50% of the 3.6 are empty but have a related db row. if (!string.IsNullOrWhiteSpace(sNotes)) { //Display something that maks me feel like its actually working Console.WriteLine("Processing {0} - {1} of 23646", rec.Number, iCount.ToString()); //Ive had a couple of runs at this using different methods and NO SORTING so there is the possibility that the notes have already been copied. if (!sExistingNotes.Contains(sNotes)) { if (rec.DateRegistered <= rec.DateReceived) { //If the date registered and date recieved are in the wrong order RM gets cranky. we check and save if needed, this is a data vallidation issue from the migration. DateTime tdtDateReceived = rec.DateReceived; rec.DateRegistered = (TrimDateTime)tdtDateReceived.AddHours(1); rec.Save(); } try { rec.Save(); Console.WriteLine("Notes transfered from udf to record notes"); } catch (Exception exp) { Console.WriteLine("Error saving notes. " + exp.Message.ToString()); } } else { Console.WriteLine("User defined notes already in Record notes"); } } else { Console.WriteLine("User defined notes empty"); } } else { Console.WriteLine("Uri {0} not found", lUri.ToString()); } } catch (Exception exp) { Console.WriteLine("Error: {0}", exp.Message.ToString()); } } } }
static void Main(string[] args) { using (Database db = new Database()) { TrimMainObjectSearch objs = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objs.SetSearchString("not ApplicationNumber:\"\""); //not RequestNumber:"" //PropertyNumber:88 to 2446699 //not ApplicationNumber:"" // //503 app number string //504 Prop number number //505 request number string // //type:16 and not ECMSTDJobNo:\"\" //type:16 and not ECMSTDJobNo:"" //ECMInfringementInfringementID: FieldDefinition fdApplicationList = new FieldDefinition(db, 1002); FieldDefinition fdPropertyList = new FieldDefinition(db, 1003); FieldDefinition fdRequestNumber = new FieldDefinition(db, 505); FieldDefinition fdPropertyNumber = new FieldDefinition(db, 504); FieldDefinition fdApplicationNumber = new FieldDefinition(db, 503); Console.WriteLine("Count: " + objs.FastCount.ToString()); foreach (Record r in objs) { Console.WriteLine("Record: " + r.Uri.ToString()); //if (r.Uri == 496206) //{ try { string sApplicationList = (string)r.GetFieldValue(fdPropertyList).ToDotNetObject(); Console.WriteLine("Record field: App list {0} ", sApplicationList); int sRequestNumber = (int)r.GetFieldValue(fdPropertyNumber).ToDotNetObject(); Console.WriteLine("Record field: App list {0}, request {1} ", sApplicationList, sRequestNumber); string sNewValue; if (!string.IsNullOrEmpty(sApplicationList)) { sNewValue = sApplicationList + " " + sRequestNumber.ToString(); } else { sNewValue = sRequestNumber.ToString(); } Console.WriteLine("Record field: App list {0}, request {1}, new value {2} ", sApplicationList, sRequestNumber, sNewValue); r.SetFieldValue(fdApplicationList, new UserFieldValue(sNewValue)); r.Save(); Console.WriteLine("Record updated"); //Console.ReadLine(); } catch (Exception exp) { Console.WriteLine("Error: " + exp.Message.ToString()); //Console.ReadLine(); } //} //string sApplicationNumbert = (string)r.GetFieldValue(fdApplicationNumber).ToDotNetObject(); //if (sApplicationList == ";") //{ // r.SetFieldValue(fdApplicationList, new UserFieldValue()); //} //string sPropertyList = (string)r.GetFieldValue(fdPropertyList).ToDotNetObject(); //if (sPropertyList == ";") //{ // rk // r.SetFieldValue(fdPropertyList, new UserFieldValue()); //} } } }
static void Main(string[] args) { List<ACL> lstAcl = new List<ACL>(); using (SqlConnection con = new SqlConnection("Data Source=Cl1025;Initial Catalog=StagingMove;Integrated Security=True")) { con.Open(); using (SqlCommand command = new SqlCommand("SELECT [ECMClass],[EddieAcl] FROM [StagingMove].[dbo].[SetAcl] where Run = 1", con)) { //DataTable dt = new DataTable(); //SqlDataAdapter da = new SqlDataAdapter(); //da.SelectCommand = command; //da.Fill(dt); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { ACL acl = new ACL(); acl.EcmClass = reader.GetString(0).Trim(); acl.RMlocation = reader.GetString(1).Trim(); lstAcl.Add(acl); } } } } Console.WriteLine("What is the origin uri?"); int iOuri = Convert.ToInt32(Console.ReadLine()); foreach (ACL acl in lstAcl) { try { using (Database db = new Database()) { //Console.WriteLine("Enter ECM class name"); TrimMainObjectSearch sObj = new TrimMainObjectSearch(db, BaseObjectTypes.Record); //ECMSTDClassName:"Confidential Transition" and type:16 //string str = @""+Console.ReadLine()+""; //sObj.SetSearchString("ECMSTDClassName:\"" + acl.EcmClass + "\" and type:16 and updated>9/03/2016"); sObj.SetSearchString("ECMSTDClassName:\"" + acl.EcmClass + "\" and type:16 and originRun:"+iOuri); Console.WriteLine(sObj.SearchString); Console.WriteLine("Record count: " + sObj.FastCount.ToString()); if (sObj.FastCount > 0) { FieldDefinition fdDocDate = new FieldDefinition(db, 85); LocationList lstLoc = new LocationList(); Location l = new Location(db, acl.RMlocation); lstLoc.Add(l); foreach (Record r in sObj) { if(r.DateRegistered<=r.DateReceived) { DateTime tdtDateReceived = r.DateReceived; r.DateRegistered = (TrimDateTime)tdtDateReceived.AddHours(1); } r.Save(); //TrimDateTime rmDt = (TrimDateTime)r.GetFieldValue(fdDocDate).ToDotNetObject(); //r.DateReceived = rmDt; //r.DateCreated = rmDt; //r.Save(); // TrimAccessControlList lstacl = r.AccessControlList; lstacl.set_AccessLocations((int)RecordAccess.ViewRecord, lstLoc); lstacl.set_AccessLocations((int)RecordAccess.ViewDocument, lstLoc); r.AccessControlList = lstacl; try { r.Save(); Console.WriteLine("ACL applied to " + r.Number); } catch (Exception exp) { Console.WriteLine("ACL failed, Error: " + exp.Message.ToString()); } } } } } catch (Exception exp) { Console.WriteLine("Error: " + exp.Message.ToString()); } } Console.ReadLine(); }
static void Main(string[] args) { if (!TrimApplication.HasBeenInitialized) { TrimApplication.Initialize(); } TrimApplication.HasUserInterface = true; // List<Sheets> myMessage = JsonConvert.DeserializeObject<List<Sheets>>(File.ReadAllText(@"C:\temp\SSprocess.json")); List<RM> lstRm = new List<RM>(); using (Database db = new Database()) { db.Connect(); //10030-Westview Cres NAMBOUR //var p = "10030-Westview Cres NAMBOURR"; Record rec = null; TrimMainObjectSearch objS = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objS.SetSearchString("classification:7726"); //if (objS.FastCount == 0) //Console.WriteLine("No results for this folder under the class: " + cl3.Title + "/" + p); foreach (Record r in objS) { RM rm = new RM(); rm.Uri = r.Uri; rm.title = r.Title; lstRm.Add(rm); //Console.WriteLine("Loop through folders under class:" + p + "/" + r.Title); //if (r.Title == p.Trim()) //{ // rec = r; //} } //if (rec != null) //{ // Console.WriteLine("Found record:" + rec.Uri); //} //else //{ // Console.WriteLine("Record is null"); //} } Console.WriteLine("Record count: " + lstRm.Count().ToString()); Console.ReadLine(); foreach (var file in myMessage) { //file.Rows.Skip(9880).Take(30) //file.Rows.Where(x => x.RMuri == "0" && x.Error == null).Take(30) //.Where(x=>x.Error==null && x.RMuri=="0") Console.WriteLine("SS row count: " + file.Rows.Count().ToString()); foreach (Rows r in file.Rows.Where(x => x.Folder !=null && x.RMuri == "0").Take(30)) { //.Trim() var d = r.Folder.Trim(); var h = "Not found"; if(lstRm.Exists(x=>x.title.Contains(d))) { h = lstRm.Find(x=>x.title==d).title; } Console.WriteLine("Process test: " + r.Folder + " / "+ h); // (x => x.title == d).FirstOrDefault().title); } } Console.ReadLine(); }
private void button4_Click(object sender, EventArgs e) { using (Database TrimDb = new Database()) { TrimMainObjectSearch baseSearch = new TrimMainObjectSearch(TrimDb, BaseObjectTypes.Record); // to be replaced by saved search baseSearch.SetSearchString("uri:"+textBox1.Text); //baseSearch.SetSortString("id"); //MessageBox.Show("Check baseSearch: " + baseSearch.FastCount, "", MessageBoxButtons.OK); //TrimMainObjectSearch resultSearch = ObjectSelector.SelectOne(this.Handle, baseSearch); //(this.Handle, baseSearch); TrimMainObject tmo = ObjectSelector.SelectOne(this.Handle, baseSearch); if (tmo != null) { if (tmo.TrimType == BaseObjectTypes.Record) { //Classification cl = (Classification)tmo; Record r = (Record)tmo; //label3.Text = cl.Title + "(" + cl.Uri.ToString() + ")"; label3.Text = r.Title + "(" + r.Number + ")"; } else { MessageBox.Show("You need to select a folder"); } } else { MessageBox.Show("Uri not found"); } // } }
private static Record CheckifFolderAlreadyExists(Classification cl3, string p, Database db) { Record rec = null; TrimMainObjectSearch objS = new TrimMainObjectSearch(db, BaseObjectTypes.Record); objS.SetSearchString("classification:" + cl3.Uri); //if (objS.FastCount == 0) // Console.WriteLine("No results for this folder under the class: " + cl3.Title + "/" + p); foreach (Record r in objS) { //Console.WriteLine("Loop through folders under class:"+p+"/"+r.Title); if (r.Title == p.Trim()) { rec = r; } } if (rec != null) { Console.WriteLine("Found record:" + rec.Uri); } else { Console.WriteLine("Record is null"); } return rec; }