This example shows how to query the existing Classifications for a URL. No attempt is made to classify the data.
There are four possible outcomes to the query.
The full code example is as follows:
// Create the proxy class that connects to the remote service.
CCS.CCSClassifyClient proxyClassify = new CCS.CCSClassifyClient();
// Create the arguments object and set options
CCS.ClassificationArgs classifyArgs = new CCS.ClassificationArgs();
// Set the locale if required
classifyArgs.Locale = "en-gb";
// Set action to retrieve only
classifyArgs.AnalyzeDataAction = CCS.AnalyzeDataActionType.None;
// Should the CCS timeout and return early if it doesn't have result
classifyArgs. TimeOutMilliseconds = 0;
// We may not always want to know the classification results
classifyArgs.ReturnClassifications = true;
// Is the data passed by reference or included in this object
classifyArgs.DataLocation = CCS.DataLocationType.Reference;
// Add identifier
CCS.ContentIdentifierList itemList = new CCS.ContentIdentifierList();
CCS.ContentIdentifier item = new CCS.ContentIdentifier();
item.IdentifierType = CCS.ContentIdentifierType.URL;
item.Identifier = "http://myserver.com/Shared Documents/important.doc";
item.CanAccessContent = false;
item.CanRetrieveLastModifiedDate = false;
item.DoNotCacheIdentifier = false;
itemList.Add(item);
// Add the item list to the args object
classifyArgs.IdentifierList = itemList;
// Call the classifier
CCS.ClassifyResult csResult = proxyClassify.Classify(classifyArgs);
// Process the results
Console.WriteLine("Severity: {0} ErrorCode: {1} = {2}",
csResult.Severity.ToString(), csResult.ErrorCode.ToString(),
csResult.ErrorMessage);
if (csResult.ErrorCode.Equals(0))
{
// Process the classifications
foreach (var classItem in csResult. Classifications)
{
Console.WriteLine("ClassificationID: {0}", classItem.ClassificationID);
}
}
// The proxy instance can be used for multiple calls but should
// be closed when no longer required.
proxyClassify.Close();
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|