Accessing Part on Shared Drive

Phenom
Phenom

I have a simple program that calculates the physical properties of parts in an assembly of which few are saved on local drive and other parts are on a mapped drive.

The user has all rights, access and privileges to read-write-delete the parts on the mapped drive.

But the VB.Net program is not able to access i.e. open parts on the mapped drive to get the physical properties.

Has anyone encountered similar problem of being unable to open Solid Edge parts from a mapped drive. Are there any precautions, fixes or workarounds to handle such issues ?

Any help is appreciated.

 

~Tushar Suradkar

 

2 REPLIES

Re: Accessing Part on Shared Drive

Legend
Legend

Hi Tushar,

 

We work with mapped drives and have not experienced any problems.

 

In any case, to avoid problems, what we do is convert all paths to absolute server paths (ie, we convert D:\DataFolder to \\server\folder1\folder2\DataFolder or wahtever).

 

I use the next VB.NET code snippet to do that:

 

Imports System.Management

Public Shared Function ConvertToUncPath(ByVal filePath As String) As String
        Dim driveLetter As String = System.IO.Path.GetPathRoot(filePath).Replace("\", "")
        Dim uncPath As String = driveLetter
        Dim query As New System.Management.ObjectQuery("select * from Win32_LogicalDisk")
        Using searcher As New System.Management.ManagementObjectSearcher(query)
            'loops for all drives on system
            For Each Mgmt As System.Management.ManagementObject In searcher.Get()
                'looks for drives with drivetype of 4 which is network drive
                If Mgmt("DriveType").ToString = "4" Then
                    If driveLetter = Mgmt("Caption").ToString Then
                        uncPath = Mgmt("ProviderName").ToString
                        Exit For
                    End If
                End If
            Next
        End Using
        Return filePath.Replace(driveLetter, uncPath)
End Function

Hope it helps.

 

 

Héctor Pelayo Izquierdo
Engineering Department, JAE Ingeniería y Desarrollos, S.L.
Solid Edge ST9 MP5 | NX 9
Development: VB.NET

Re: Accessing Part on Shared Drive

Phenom
Phenom

Thanks for sharing the code Hector. I will try to implement it.

 

Regards,

Tushar Suradkar