public static bool DeleteTestWorkspace(Int32 workspaceID, IServicesMgr svcMgr, string userName, string password) { WriteResultSet <Workspace> resultSet = null; using (var proxy = svcMgr.GetProxy <IRSAPIClient>(userName, password)) { proxy.APIOptions.WorkspaceID = -1; try { //Create a Workspace Artifact and pass to the Delete method on the repository var workspaceDTO = new kCura.Relativity.Client.DTOs.Workspace(workspaceID); resultSet = proxy.Repositories.Workspace.Delete(workspaceDTO); } catch (Exception ex) { Console.WriteLine("An error occurred deleting the Workspace: {0}", ex.Message); return(false); } if (!resultSet.Success) { Console.WriteLine("An error occurred deleting the Workspace: {0}", resultSet.Message); return(false); } return(true); } }
public async static Task <Int32> CreateWorkspaceAsync(string workspaceName, string templeteName, IServicesMgr svcMgr, string userName, string password) { using (var client = svcMgr.GetProxy <IRSAPIClient>(userName, password)) { client.APIOptions.WorkspaceID = -1; //return await Create(client, workspaceName, templeteName); return(await Task.Run(() => Create(client, workspaceName, templeteName))); } }
public static Int32 GetRootFolderArtifactID(Int32 workspaceID, IServicesMgr svgMgr, string userName, string password) { using (IRSAPIClient client = svgMgr.GetProxy <IRSAPIClient>(userName, password)) { Query <Folder> query = new Query <Folder>(); query.Condition = new TextCondition(FolderFieldNames.Name, TextConditionEnum.EqualTo, WorkspaceHelpers.WorkspaceHelpers.GetWorkspaceName(client, workspaceID)); query.Fields = FieldValue.NoFields; var ResultSet = client.Repositories.Folder.Query(query); if (!ResultSet.Success) { throw new System.Exception("Folder was not found"); } else if (ResultSet.TotalCount == 0) { throw new System.Exception("folder count was 0, so the folder was not found"); } return(ResultSet.Results.FirstOrDefault().Artifact.ArtifactID); } }