How do I access a file?

Sep 20, 2011 at 6:38 PM

I cannot seem to get the file copy or any other method to work.

 

I can connect to the device - but what type of address scheme is the file system/file naming format.

 

I do not understand how to do what I want which is:

- Copy a file (or a directory) from the device to my local computer.

 

Thanks

Sep 20, 2011 at 6:55 PM

VB.Net:

Imports OpenNETCF.Desktop.Communication

 

 

    Private Function DoesCEFileExist(ByVal FileName As String) As Boolean
        ConnectToiPAQ()
        Return myrapi.DeviceFileExists(FileName)
        DisconnectFromIpaq()
    End Function

    Private Sub ConnectToiPAQ()
        If myrapi.DevicePresent Then
            myrapi.Connect()
        Else
            MessageBox.Show("Please connect your device to your PC using ActiveSync/WMDC before clicking the OK button.", "Device was not detected")
            If myrapi.DevicePresent Then
                myrapi.Connect()
            Else
                MessageBox.Show("Please connect your device to your PC using ActiveSync/WMDC before clicking the OK button. If you have just docked your unit, please wait for ActiveSync/WMDC to start up and connect to your devicebefore pressing OK", "Device still has not been detected")
                If myrapi.DevicePresent Then
                    myrapi.Connect()
                Else
                    MessageBox.Show("Please verify " & Me.SyncMethod() & " is running and displays 'Connected' before clicking the OK button. If the device cannot be detected at this point, this application will shut down.", "Device was not detected, last try.")
                    If myrapi.DevicePresent Then
                        myrapi.Connect()
                    Else
                        Throw New Exception("DeviceNotConnected")
                    End If
                End If
            End If
        End If
    End Sub

    Private Sub DisconnectFromIpaq()
        myrapi.Disconnect()
        myrapi.Dispose()
    End Sub

 

 

    Private Sub CopyFilefromDeviceToPC()

        ConnectToiPAQ()

        If DoesCEFileExist(DevicePath + FileName) = True Then
            Try
                myrapi.CopyFileFromDevice(SourcePath & File, DevicePath & File)
            Catch ex As Exception
                Throw New Exception("ErrorCopyingFileFromDevice:" & ex.Message)
            End Try
        Else
            Throw New Exception("FiledoesntExistOnDevice")
        End If

        DisconnectFromIpaq()

    End Sub

 

Sep 20, 2011 at 7:09 PM

Thanks.  I had just figured it out.

 

My mistake was that I was using the local file and remote file in the wrong places in the call to CopyFileFromDevice().

 

Thanks for the speedy reply.