Interface IFolderService
Represents the Folder API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IFolderService
  Examples
IFolderService _folderService = relativityFacade.Resolve<IFolderService>();
  Methods
| Improve this Doc View SourceCreate(Int32, Folder)
Creates the specified Folder in specified workspace.
Declaration
Folder Create(int workspaceArtifactID, Folder folder)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| Folder | folder | The Folder to create. If ParentFolder does not have valid ArtifactID, the root folder of the repository will be set as the parent for created folder.  | 
      
Returns
| Type | Description | 
|---|---|
| Folder | Created Folder.  | 
      
Examples
This example shows how to create folder, which parent is the workspace root folder.
int workspaceArtifactId = 1015427;
var folderToCreate = new Folder
{
	Name = "Test Folder"
};
Folder createdFolder = _folderService.Create(workspaceArtifactId, folderToCreate)
  This example shows how to create folder, which parent is folder with known ArtifactID.
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 1015657;
var folderToCreate = new Folder
{
	Name = "Test Folder",
	ParentFolder = new NamedArtifact
	{
		ArtifactID = existingFolderArtifactID
	}
};
Folder createdFolder = _folderService.Create(workspaceArtifactId, folderToCreate);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  DeleteUnused(Int32)
Deletes unused (empty) folders from the workspace.
Declaration
QueryResult<Artifact> DeleteUnused(int workspaceArtifactID)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
Returns
| Type | Description | 
|---|---|
| QueryResult<Artifact> | QueryResult that lists the deleted folders.  | 
      
Examples
int workspaceArtifactId = 1015427;
QueryResult<Artifact> result = _folderService.DeleteUnused(workspaceArtifactId);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Get(Int32, Int32, Nullable<Int32>)
Gets folder by ArtifactID. Parent Folder Artifact ID must be set if it's not the Workspace Root Folder (then it can be skipped).
Declaration
Folder Get(int workspaceArtifactID, int folderArtifactID, int? parentFolderArtifactID = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| System.Int32 | folderArtifactID | The ArtifactID of the Folder.  | 
      
| System.Nullable<System.Int32> | parentFolderArtifactID | The ArtifactID of the parent folder.  | 
      
Returns
| Type | Description | 
|---|---|
| Folder | The Folder.  | 
      
Examples
This example shows how to get a folder by ArtifactID, which parent isn't the workspace root folder.
int workspaceArtifactId = 1015427;
int existingFolderParentArtifactID = 1015656;
int existingFolderArtifactID = 1015657;
Folder folder = _folderService.Get(workspaceArtifactId, existingFolderArtifactID, existingFolderArtifactID);
  This example shows how to get a folder by ArtifactID, which parent is workspace root folder.
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 1015657;
Folder folder = _folderService.Get(workspaceArtifactId, existingFolderArtifactID);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetAccessStatus(Int32, Int32)
Gets information about the user‘s ability to access the folder.
Declaration
FolderAccessStatus GetAccessStatus(int workspaceArtifactID, int folderArtifactID)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| System.Int32 | folderArtifactID | The ArtifactID of the Folder.  | 
      
Returns
| Type | Description | 
|---|---|
| FolderAccessStatus | The FolderAccessStatus.  | 
      
Examples
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 1015657;
FolderAccessStatus folderAccessStatus = _folderService.GetAccessStatus(workspaceArtifactId, existingFolderArtifactID);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetExpandedNodes(Int32, List<Int32>, Int32)
Gets a folder structure that contains expanded Folder nodes and can select folder by Artifact ID.
Declaration
List<Folder> GetExpandedNodes(int workspaceArtifactID, List<int> expandedNodesArtifactIDs, int selectedFolderArtifactID = 0)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| System.Collections.Generic.List<System.Int32> | expandedNodesArtifactIDs | List of Artifact IDs of specified folders that you want to retrieve information about.  | 
      
| System.Int32 | selectedFolderArtifactID | An optional field with ArtifactID of the folder that will be marked as selected.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<Folder> | A list of children Folder for all expanded folders.  | 
      
Examples
This example shows how to get folder structure with expanded folder with known ArtifactIDs and select one of them.
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 1015657;
int existingFolderToSelectArtifactID = 1015652;
List<int> expandedNodesArtifactIDs = new List<int>
{
	1015657,
	existingFolderToSelectArtifactID
}
List<Folder> expandedNodes = _folderService.GetExpandedNodes(workspaceArtifactId, expandedNodesArtifactIDs, existingFolderToSelectArtifactID);
  This examples shows how to get folder structure with expanded folder with known ArtifactIDs.
int workspaceArtifactId = 1015427;
List<int> expandedNodesArtifactIDs = new List<int>
{
	1015657,
	1015623
}
List<Folder> expandedNodes = _folderService.GetExpandedNodes(workspaceArtifactId, expandedNodesArtifactIDs);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetSubfolders(Int32, Int32)
Gets subfolders of given Folder.
Declaration
List<Folder> GetSubfolders(int workspaceArtifactID, int parentFolderArtifactID)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| System.Int32 | parentFolderArtifactID | The ArtifactID of the parent folder.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<Folder> | The list of subfolders of the given Folder.  | 
      
Examples
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 1015657;
List<Folder> subfolders = _folderService.GetSubfolders(workspaceArtifactId, existingFolderArtifactID);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetWorkspaceRootFolder(Int32)
Gets the root Folder of the workspace.
Declaration
Folder GetWorkspaceRootFolder(int workspaceArtifactID)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
Returns
| Type | Description | 
|---|---|
| Folder | The root Folder of the workspace.  | 
      
Examples
int workspaceArtifactId = 1015427;
Folder rootFolder = _folderService.GetWorkspaceRootFolder(workspaceArtifactId);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Move(Int32, Int32, Int32)
Moves a Folder and its children, including subfolders and documents.
Declaration
FolderMoveResponse Move(int workspaceArtifactID, int folderArtifactID, int destinationFolderArtifactID)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| System.Int32 | folderArtifactID | The ArtifactID of the folder to move.  | 
      
| System.Int32 | destinationFolderArtifactID | The ArtifactID of the destination folder.  | 
      
Returns
| Type | Description | 
|---|---|
| FolderMoveResponse | FolderMoveResponse including information about the result of the move operation.  | 
      
Examples
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 10154324;
int existingDestinationFolderArtifactID = 101543223;
Folder updatedFolder = _folderService.Move(workspaceArtifactId, existingFolderArtifactID, existingDestinationFolderArtifactID);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Query(Int32, Query, Int32)
Queries for unstructured list of Folders.
Declaration
QueryResult<NamedArtifact> Query(int workspaceArtifactID, Query query, int length = 0)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| Query | query | The query that may be an empty query or include conditions.  | 
      
| System.Int32 | length | Indicates the number of returned results. The default value is 0 for length, and the number of returned results defaults to 10000.  | 
      
Returns
| Type | Description | 
|---|---|
| QueryResult<NamedArtifact> | A QueryResult with a list of all folders in the workspace that are available to requesting user.  | 
      
Examples
This example shows how to query for folder with given Name.
int workspaceArtifactId = 1015427;
var query = new Query
{
	Condition = "'Name' == 'Test'"
};
Folder folderWithTestName = _folderService.Get(workspaceArtifactId, query, 1).Results.FirstOrDefault();
  This example shows how to query for all folders in the workspace.
int workspaceArtifactId = 1015427;
var query = new Query();
QueryResult<NamedArtifact> folders = _folderService.Query(workspaceArtifactId, query)
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Update(Int32, Folder)
Updates Folder.
Declaration
Folder Update(int workspaceArtifactID, Folder folder)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | workspaceArtifactID | The ArtifactID of the workspace.  | 
      
| Folder | folder | Folder to update.  | 
      
Returns
| Type | Description | 
|---|---|
| Folder | Updated Folder.  | 
      
Remarks
If the request contains an Artifact ID that differs from ID for the original parent folder, the folder is moved to the parent folder specified in the request. If a parent folder isn't specified, the folder is moved to the root folder of the workspace.
Examples
This example shows how to update Name of the Folder.
int workspaceArtifactId = 1015427;
int folderArtifactID = 10154324;
int parentFolderArtifactID = 10154321;
Folder folderToUpdate = _folderService.Get(workspaceArtifactId, folderArtifactID, parentFolderArtifactID);
folderToUpdate.Name = "New Folder Name";
Folder updatedFolder = _folderService.Update(workspaceArtifactId, folderToUpdate);
  This example shows how to move folder to workspace root folder using Update method.
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 10154324;
Folder folderToUpdate = new Folder
{
	Name = "Some Existing Folder Name",
	ArtifactID = existingFolderArtifactID
};
Folder updatedFolder = _folderService.Update(workspaceArtifactId, folderToUpdate);
  This example shows how to move folder to some existing folder.
int workspaceArtifactId = 1015427;
int existingFolderArtifactID = 10154324;
int newParentFolderArtifactID = 101543223;
Folder folderToUpdate = new Folder
{
	Name = "Some Existing Folder Name",
	ArtifactID = existingFolderArtifactID,
	ParentFolder = new NamedArtifact
	{
		ArtifactID = newParentFolderArtifactID,
	}
};
Folder updatedFolder = _folderService.Update(workspaceArtifactId, folderToUpdate);