You are here

You are here

Finding a Folder by Path

Finding a folder by path is useful when the the taxonomy is known, but the Folder's Id is not.

Many other API calls need the Folder's ID, so a call can be made to ParsePath first to determine its Id.  The same call is used to find a Document by path as well.

Inputs

  • token – Authentication token used in all SOAP calls
  • currentFolderId – This is the folder SpringCM will use as the root to start looking for the item specified in the path parameter.  It may be empty, in which case the path parameter will be treated as an absolute path not including the account name.
  • path – The path to a folder or document by name relative to the folder ID specified in the currentFolderId parameter.
  • loadExtendedMetadata – Whether metadata on the folder or document is loaded, it should generally return false if the metadata is not needed for performance reasons.

Output

This method returns an SCMPath object with 5 properties.  The Result property is an enumeration that tells you if the path does not exist, is a root folder, represents a folder, or represents a document.  The DocumentPortion and FolderPortion properties give the string representation of the path of the folder and document.  More commonly used are the Folder and/or Document properties, which are the actual SCMFolder and SCMDocument objects represented by the path passed in.  It should be noted that if the path represents a folder and not a document, the DocumentPortion and Document properties will be blank.

Vertical Tabs

c#
SCMPath path = springCMService.ParsePath(token, "", "/Customers/Company ABC", true);
if (path.Result == ParseResult.PathDoesNotExist)
{
	Console.WriteLine("Path does not exist");
}
else if (path.Result == ParseResult.PathIsFolder)
{
	SCMFolder folder = path.Folder;
	Console.WriteLine("Successfully found: " + folder.Id);
}
java
SCMPath path = springCMService.parsePath(token, "", "/Customers/Company ABC", true);
if (path.getResult() == ParseResult.PathDoesNotExist)
{
	System.out.println("Path does not exist");
}
else if (path.getResult() == ParseResult.PathIsDocument)
{
	SCMDocument document = path.getDocument();
	System.out.println("Successfully found: " + document.getId());
}