You are here

You are here

Find Document By Path

Knowing the folder path of a document can be a powerful way to retrieve a reference to a SCMDocument object.

A path can either be fully qualified or can start from another folder within SpringCM.  If the path is fully qualified no currentFolderId parameter is needed and it can be left as an empty string.  If the path is relative to a parent folder, the currentFolderId should be set to the parent folder and the path would start from that folder.

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/Contract Q1.docx", true);
if (path.Result == ParseResult.PathDoesNotExist)
{
       Console.WriteLine("Path does not exist");
}
else if (path.Result == ParseResult.PathIsDocument)
{
      SCMDocument document = path.Document;
      Console.WriteLine("Successfully found: " + document.Id);
} 
java
SCMPath path = springCMService.parsePath(token, "", "/Customers/Company ABC/Contract Q1.docx", 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());
}