Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- using InterplayWSTest3.InterplayWS;
- namespace InterplayWSCSharpTest3
- {
- class Program
- {
- private static int urlHeaderLengh = 0;
- private static string theDate = "2014-04-13T05:00:00.000-0400";
- static void Main(string[] args)
- {
- Console.WriteLine("Interplay WS Test");
- Console.WriteLine("Print out all assets created after " + theDate);
- AssetsPortTypeClient port = new AssetsPortTypeClient();
- UserCredentialsType creds = new UserCredentialsType();
- creds.Username = "administrator";
- creds.Password = "avid";
- string urlHeader = "interplay://WGC/Projects";
- urlHeaderLengh = "interplay://WGC".Length;
- ListFolderContents(port, creds, urlHeader);
- Console.Write("Hit enter to end.");
- Console.ReadLine();
- }
- private static void ListFolderContents(AssetsPortTypeClient port, UserCredentialsType creds, string path)
- {
- Console.WriteLine(path);
- ListMobs(port, creds, path);
- GetChildrenType getChildrenParams = new GetChildrenType();
- getChildrenParams.InterplayURI = path;
- getChildrenParams.IncludeFolders = true;
- getChildrenParams.IncludeFoldersSpecified = true;
- getChildrenParams.IncludeFiles = false;
- getChildrenParams.IncludeFilesSpecified = true;
- getChildrenParams.IncludeMOBs = false;
- getChildrenParams.IncludeMOBsSpecified = true;
- getChildrenParams.ReturnAttributes = new AttributeType[1];
- getChildrenParams.ReturnAttributes[0] = new AttributeType();
- getChildrenParams.ReturnAttributes[0].Group = "USER";
- getChildrenParams.ReturnAttributes[0].Name = "Display Name";
- GetChildrenResponseType getChildrenResponse = port.GetChildren(creds, getChildrenParams);
- if (getChildrenResponse.Results != null && getChildrenResponse.Results.Length > 0)
- {
- foreach (AssetDescriptionType ad in getChildrenResponse.Results)
- {
- string childPath = null;
- foreach (AttributeType att in ad.Attributes)
- {
- if (att.Group.Equals("USER") && att.Name.Equals("Display Name"))
- childPath = att.Value;
- }
- if (childPath != null)
- ListFolderContents(port, creds, path + "/" + childPath);
- }
- }
- }
- private static void ListMobs(AssetsPortTypeClient port, UserCredentialsType creds, string path)
- {
- SearchType param = new SearchType();
- param.InterplayPathURI = path;
- param.SearchGroup = new SearchGroupType();
- param.SearchGroup.Operator = "AND";
- param.SearchGroup.AttributeCondition = new AttributeConditionType[2];
- param.SearchGroup.AttributeCondition[0] = new AttributeConditionType();
- param.SearchGroup.AttributeCondition[0].Condition = "CONTAINS";
- param.SearchGroup.AttributeCondition[0].Attribute = new AttributeType();
- param.SearchGroup.AttributeCondition[0].Attribute.Group = "SYSTEM";
- param.SearchGroup.AttributeCondition[0].Attribute.Name = "Path";
- param.SearchGroup.AttributeCondition[0].Attribute.Value = path.Substring(urlHeaderLengh) + "/060a2b340101010101010f0013";
- param.SearchGroup.AttributeCondition[1] = new AttributeConditionType();
- param.SearchGroup.AttributeCondition[1].Condition = "GREATER_THAN";
- param.SearchGroup.AttributeCondition[1].Attribute = new AttributeType();
- param.SearchGroup.AttributeCondition[1].Attribute.Group = "SYSTEM";
- param.SearchGroup.AttributeCondition[1].Attribute.Name = "Creation Date";
- param.SearchGroup.AttributeCondition[1].Attribute.Value = theDate;
- param.ReturnAttributes = new AttributeType[2];
- param.ReturnAttributes[0] = new AttributeType();
- param.ReturnAttributes[0].Group = "USER";
- param.ReturnAttributes[0].Name = "Display Name";
- param.ReturnAttributes[1] = new AttributeType();
- param.ReturnAttributes[1].Group = "SYSTEM";
- param.ReturnAttributes[1].Name = "Type";
- SearchRequest request = new SearchRequest();
- request.UserCredentials = creds;
- request.Search = param;
- SearchResponseType response = port.Search(creds, param);
- if (response.Results.Length > 0)
- {
- foreach (AssetDescriptionType ad in response.Results)
- {
- foreach (AttributeType att in ad.Attributes)
- {
- if (att.Group.Equals("USER") && att.Name.Equals("Display Name"))
- Console.Write(" " + att.Name + " = " + att.Value);
- if (att.Group.Equals("SYSTEM") && att.Name.Equals("Type"))
- Console.WriteLine(", " + att.Name + " = " + att.Value);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement