Beispiel #1
0
 public string FindClassificationByPath(string path)
 {
     string result;
     var searchExpr = new SearchExpression("NamePath=" + path);
     var classificationCollection = new ClassificationCollection(application);
     classificationCollection.Load(searchExpr);
     if (classificationCollection.Count > 0)
         result = classificationCollection[0].Name;
     else
         result = "Not found";
     return result;
 }
        static void Main(string[] args)
        {
            Application app = new Application();

            LogOnStatus status = app.LogOn("LUXDAM", "Eduard_Pasmetukhau", "P2ssw0rd!");

            if (status == LogOnStatus.LoggedOn)
            {
                Console.WriteLine("Ok");
            }
            else Console.WriteLine(status);

            Classification c = new Classification(app);
            ClassificationHelper ch = new ClassificationHelper(app);
            Guid? rootGuid= ch.GetId(new SearchExpression("name = 'Luxottica Content*'"));
            
            Console.WriteLine("List of classification with parent Luxottica Content");
            //Console.ReadKey();


            if (rootGuid != null)
            {
                ClassificationCollection classCollections = new ClassificationCollection(app);
                classCollections.Load(new SearchExpression(String.Format("parent = '{0}'", rootGuid)));
                foreach (Classification classification in classCollections)
                {
                    Console.WriteLine(classification.Label + " Guid: "+classification.Id);
                }
            }
            Console.WriteLine();
            Console.ReadKey();
            Console.WriteLine("First 10 Guids of Records in classification Luxottica Content");

            RecordCollection rc = new RecordCollection(app);
            rc.Load(new SearchExpression(String.Format("classification = '{0}'", rootGuid)));
            

            foreach (Record r in rc.Take<Record>(10))
            {
                Console.WriteLine(r.Id);
            }

            Console.ReadKey();

            
        }
Beispiel #3
0
        public List<string> FindClassificationByPathAndDate(string path, DateTime date)
        {
            //TO DO here subclassification, not root
            var result = new List<string>();
            string id;
            var searchExpr = new SearchExpression("NamePath=" + path);
            var classificationCollection = new ClassificationCollection(application);
            classificationCollection.Load(searchExpr);
            if (classificationCollection.Count > 0)
                id = classificationCollection[0].Id.ToString();
            else
                throw new Exception("Not found");

            searchExpr = new SearchExpression("Root=" + id + " AND CreatedOn > " + date.Month + '/' + date.Day + '/' + date.Year);

            classificationCollection = new ClassificationCollection(application);
            classificationCollection.Load(searchExpr);

            foreach (Classification classification in classificationCollection)
            {
                result.Add(classification.Name);
            }
            return result;
        }