Results 1 to 3 of 3

Thread: Problem with permission when copy files

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2010
    Posts
    63

    Problem with permission when copy files

    Hello everyone

    I'm facing an issue
    I'm using this code to copy all the files
    Code:
            Try
                My.Computer.FileSystem.CopyDirectory(VBFrom_Path, VBTo_Path, True)
            Catch ex As Exception
                MsgBox("Unable to make the copy")
            End Try
    The problem is when in the VBTo_Path put a folder on a server without having permission in this folder. (Absolutely logical)

    Is there any way to give permission thru the program?? I don't want users had permission in a server folder!!!

    Thanks and regards

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Problem with permission when copy files

    Usually, although not always, a user wouldn't be granting themselves permission to write to a folder. That would rather defeat the purpose of folder permissions. Is this a special case for some reason?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Problem with permission when copy files

    Ela.
    You can use impersonation to give elevated permissions.
    Take a look at this post that had somewhat the same issue. The guy decided to use an xcopy implementation. I don't know how did that ended up.

    http://www.vbforums.com/showthread.p...(User-folders)
    Last edited by sapator; Oct 10th, 2018 at 08:44 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width