Click or drag to resize

ExtensionGetLocalPath Method

Returns the local path from the PDM file object.

Namespace:  CADSharpTools.PDM
Assembly:  CADSharpTools.PDM (in CADSharpTools.PDM.dll) Version: 1.4.16.0 (1.4.16)
Syntax
public static MethodReturn<string> GetLocalPath(
	this IEdmFile5 file
)

Parameters

file
Type: IEdmFile5
File object

Return Value

Type: MethodReturnString
MethodReturn of the local path.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEdmFile5. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
CADSharpToolsPDMExceptionThrown when unable to get the parent folder of the specified file object.
NullReferenceExceptionThrown when file parameter is null.
Remarks
The method does not require the PDM object ID of the file's folder as opposed to the built-in GetLocalPath(Int32).
Examples
This example shows how to print the local path of the first file found at the root of folder of a PDM vault.
using CADSharpTools.Commons;
using EPDM.Interop.epdm;
using System;
using System.Diagnostics;
namespace CADSharpTools.PDM.Tests
{
    class Test
    {
        public enum EdmLoginFlags
        {
            Nothing,
            WebClient
        }
        [STAThread]
        static void Main(string[] args)
        {
            //create vault object 
            var swPDMVault = new EdmVault5();
            var swPDMVaultEx = swPDMVault as IEdmVault13;
            //required per PDM EULA in out-of-process applications
            swPDMVaultEx.LoginEx("Admin", "****", "CADSharp LLC", (int)EdmLoginFlags.Nothing);
            // get root folder 
            var swPDMRootFolder = swPDMVaultEx.RootFolder;
            // get first file position
            var swPDMFirstFilePos = swPDMRootFolder.GetFirstFilePosition();
            if (swPDMFirstFilePos.IsNull == false)
            {
                var swPDMFirstFile = swPDMRootFolder.GetNextFile(swPDMFirstFilePos);
                // debug print local path
                var localPathRet = swPDMFirstFile.GetLocalPath();
                if (localPathRet.IsError == false)
                    Debug.Print($"First local path: {localPathRet.Value}");
                else
                    Debug.Print($"Error occurred while getting local path : {localPathRet.Error}");
            }
            else
            {
                Debug.Print($"Vault has no files at the root folder.");
            }
        }
    }
}
See Also