5 Replies Latest reply on Apr 12, 2013 10:23 AM by Jacob Cordingley

    UNC / mapped drive problem

    Per Engberg

      We are using a home-made PDM system (based on MSAccess and SQL) and have since switching to Win7 encountered a problem. When opening af file from within SW, the path uses the mapped drive letter for the location of the file e.g. T:\SW-drawings\..

      Opening the same file by searching with windows explorer and double clicking the file, the path is in UNC format, e.g. \\server-name\foldername\SW-drawings\..

      This causes our PDM to loose the connection to the file in question, and changes in the PDM data is not reflected in the drawing.


      After opening a file in these two different ways, the recently opened file list in SW has two instances of the same file (see screendump):


      Is there any setting that would consolidate these two instances into one in SW, or do we have to change our PDM-system?


      SW 2012 sp5, Win7 64bit

        • Re: UNC / mapped drive problem
          Jacob Cordingley

          I wish that SW used them UNC path in the reference files

          I have a home-made PDM system to


          I have an DLL file that will take an mapped Drive an change it to the UNC Path

          I can send this to you  would you want the Source(Visual Studio  and I think  it in 2008 .net 3.5)  or the DLL?


          what i have done is when a file is "Vaulted" they use an program that will fix the references to the UNC path that way it fixed in solidworks


          I use the Solidworks DM API and this  DLL to do it we have not had issues that i know for awhile now.

            • Re: UNC / mapped drive problem
              Per Engberg

              Hi Jacob

              The source file for your dll would be great, maybe our IT-department can adapt it to our need. My mail adress is peremovethis@andthis roblon.com.

                • Re: UNC / mapped drive problem
                  Jacob Cordingley

                  here is the VB Code


                  Public Class UNCPath


                      Public Declare Function WNetGetConnection Lib "mpr.dll" Alias _

                               "WNetGetConnectionA" (ByVal lpszLocalName As String, _

                               ByVal lpszRemoteName As String, ByRef cbRemoteName As Integer) As Integer


                      ''' <summary>

                      ''' Convert an mapped Path to an UNC Path

                      ''' </summary>

                      ''' <param name="Path">Mapped Network  Loction</param>

                      ''' <returns>UNC Network Location</returns>

                      ''' <remarks></remarks>

                      Public Shared Function GetNetworkPath(ByVal Path As String) As String


                          Dim driveletter As String = Path.Substring(0, 1)

                          Dim out As String = New String("", 260)

                          Dim len As Integer = 260


                              Dim networkpath As String

                              Dim newfilepath As String = ""

                              networkpath = WNetGetConnection(driveletter + ":", out, len)


                              Dim ii As Integer

                              While Not (out(ii) = Nothing)

                                  newfilepath = newfilepath + out(ii)

                                  ii = ii + 1

                              End While

                              If (ii > 0) Then

                                  Return newfilepath + Path.Substring(2)


                                  Return Path

                              End If



                              Return Nothing

                          End Try


                      End Function

                  End Class