/// <summary> /// Deletes the group by artifact ID. /// </summary> /// <param name="artifactId"></param> /// <returns></returns> public bool Delete(int artifactId) { var groupToDelete = new DTOs.Group(artifactId); WriteResultSet <DTOs.Group> resultSet = new WriteResultSet <DTOs.Group>(); try { using (var client = _helper.GetServicesManager().CreateProxy <IRSAPIClient>(API.ExecutionIdentity.System)) { resultSet = client.Repositories.Group.Delete(groupToDelete); } if (!resultSet.Success || resultSet.Results.Count == 0) { throw new Exception("Group not found in Relativity"); } } catch (Exception e) { Console.WriteLine("Group deletion threw an exception" + e); return(false); } return(true); }
/// <summary> /// Creates a group object /// </summary> /// <param name="name"></param> /// <returns></returns> public int Create(String name) { DTOs.Group newGroup = new DTOs.Group(); newGroup.Name = name; WriteResultSet <DTOs.Group> resultSet = new WriteResultSet <DTOs.Group>(); try { using (var client = _helper.GetServicesManager().CreateProxy <IRSAPIClient>(API.ExecutionIdentity.System)) { client.APIOptions.WorkspaceID = -1; resultSet = client.Repositories.Group.Create(newGroup); } if (!resultSet.Success || resultSet.Results.Count == 0) { throw new Exception("Group was not found"); } } catch (Exception e) { Console.WriteLine("Exception occured while trying to create a new group" + e); } var groupartid = resultSet.Results[0].Artifact.ArtifactID; return(groupartid); }