public static Int32 CreateField_MultipleChoice(IRSAPIClient client, int workspaceID) { Int32 fieldID = 0; //Set the workspace ID client.APIOptions.WorkspaceID = workspaceID; //Create a Field DTO kCura.Relativity.Client.DTOs.Field fieldDTO = new kCura.Relativity.Client.DTOs.Field(); fieldDTO.Name = string.Format("API Sample {0}", Guid.NewGuid()); fieldDTO.ObjectType = new kCura.Relativity.Client.DTOs.ObjectType() { DescriptorArtifactTypeID = (int)ArtifactType.Document }; fieldDTO.FieldTypeID = kCura.Relativity.Client.FieldType.MultipleChoice; // Set secondary fields fieldDTO.AllowGroupBy = false; fieldDTO.AllowPivot = false; fieldDTO.AllowSortTally = false; fieldDTO.AvailableInFieldTree = false; fieldDTO.IsRequired = false; fieldDTO.OpenToAssociations = false; fieldDTO.Linked = false; fieldDTO.Unicode = true; fieldDTO.Width = ""; fieldDTO.Wrapping = true; //Create the fields kCura.Relativity.Client.DTOs.WriteResultSet <kCura.Relativity.Client.DTOs.Field> resultSet = client.Repositories.Field.Create(fieldDTO); //Check for success if (resultSet.Success) { fieldID = resultSet.Results.FirstOrDefault().Artifact.ArtifactID; return(fieldID); } else { Console.WriteLine("Field was not created"); return(fieldID); } }
public static Int32 CreateField_LongText(IRSAPIClient client, int workspaceID) { Int32 fieldID = 0; //Set the workspace ID client.APIOptions.WorkspaceID = workspaceID; //Create a Field DTO kCura.Relativity.Client.DTOs.Field fieldDTO = new kCura.Relativity.Client.DTOs.Field(); //Set primary fields //The name of the sample data is being set to a random string so that sample data can be debugged //and never causes collisions. You can set this to any string that you want fieldDTO.Name = string.Format("API Sample {0}", Guid.NewGuid()); fieldDTO.ObjectType = new kCura.Relativity.Client.DTOs.ObjectType() { DescriptorArtifactTypeID = (int)ArtifactType.Document }; fieldDTO.FieldTypeID = kCura.Relativity.Client.FieldType.LongText; // Set secondary fields fieldDTO.AllowHTML = false; fieldDTO.AllowGroupBy = false; fieldDTO.AllowPivot = false; fieldDTO.AllowSortTally = false; fieldDTO.AvailableInViewer = false; fieldDTO.IncludeInTextIndex = true; fieldDTO.IsRequired = false; fieldDTO.OpenToAssociations = false; fieldDTO.Linked = false; fieldDTO.Unicode = true; fieldDTO.Width = ""; fieldDTO.Wrapping = true; //Create the field kCura.Relativity.Client.DTOs.WriteResultSet <kCura.Relativity.Client.DTOs.Field> resultSet = client.Repositories.Field.Create(fieldDTO); //Check for success if (resultSet.Success) { fieldID = resultSet.Results.FirstOrDefault().Artifact.ArtifactID; return(fieldID); } else { Console.WriteLine("Field was not created"); return(fieldID); } }
public int CreateFixedLengthTextField(int workspaceId, IServicesMgr svcMgr, ExecutionIdentity identity) { var fieldId = 0; try { using (IRSAPIClient client = svcMgr.CreateProxy <IRSAPIClient>(identity)) { //Set the workspace ID client.APIOptions.WorkspaceID = workspaceId; //Create a Field DTO kCura.Relativity.Client.DTOs.Field fieldDto = new kCura.Relativity.Client.DTOs.Field(); //Set primary fields //The name of the sample data is being set to a random string so that sample data can be debugged //and never causes collisions. You can set this to any string that you want fieldDto.Name = "Demo Document Field"; fieldDto.ObjectType = new kCura.Relativity.Client.DTOs.ObjectType() { DescriptorArtifactTypeID = (int)ArtifactType.Document }; fieldDto.FieldTypeID = FieldType.FixedLengthText; //Set secondary fields fieldDto.AllowHTML = false; fieldDto.AllowGroupBy = false; fieldDto.AllowPivot = false; fieldDto.AllowSortTally = false; fieldDto.IncludeInTextIndex = true; fieldDto.IsRequired = false; fieldDto.OpenToAssociations = false; fieldDto.Length = 255; fieldDto.Linked = false; fieldDto.Unicode = true; fieldDto.Width = ""; fieldDto.Wrapping = true; fieldDto.IsRelational = false; //Create the field kCura.Relativity.Client.DTOs.WriteResultSet <kCura.Relativity.Client.DTOs.Field> resultSet = client.Repositories.Field.Create(fieldDto); //Check for success if (!resultSet.Success) { Console.WriteLine("Field was not created"); return(fieldId); } var firstOrDefault = resultSet.Results.FirstOrDefault(); if (firstOrDefault != null) { fieldId = firstOrDefault.Artifact.ArtifactID; } return(fieldId); } } catch (Exception) { throw new Exception("Failed in the create field method."); } }