Exemple #1
0
        //public static class RelativityInformation
        //{
        //	/ <summary>
        //	/ Gets the version of the current Relativity instance
        //	/ </summary>
        //	/ <returns>The Relativity version in the format "x.x.x.x"</returns>
        //	public static async Task<string> GetRelativityVersionAsync()
        //	{
        //		string relativityVersion;
        //		using (IInstanceDetailsManager proxy = helper.GetServicesManager().GetDefaultProxy<IInstanceDetailsManager>())
        //		{
        //			relativityVersion = await proxy.GetRelativityVersionAsync();
        //		}

        //		return relativityVersion;
        //	}
        //}

        public static Int32 CreateField_LongText(IRSAPIClient client, int workspaceID, string fieldName)
        {
            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(fieldName);
            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);
            }
        }
Exemple #2
0
        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.");
            }
        }