This project is read-only.

Excepcion del tipo 'System.UnauthorizedAccessException' en AlphaFS.dll

Oct 13, 2010 at 12:42 AM

Good day
I try to use the library Alphafsdll in vb 2008 and I get the following error:
Excepcin del tipo 'System.UnauthorizedAccessException' en AlphaFS.dll
how I can fix it

Oct 13, 2010 at 12:54 AM

Could you please provide more details about what exactly are you trying to do?

Oct 13, 2010 at 3:06 AM
I'm doing a simple test to copy the dll files and alphafs alphavss in vs 2008,
this is my code:

Imports

System.IO

Imports

Alphaleonis.Win32.Vss

Imports

Alphaleonis.Win32.Filesystem

Public

Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Alphaleonis.Win32.Filesystem.File.Copy(

"D:\SHAW", "C:\PST")

End Sub

End

Class

but when I run it takes me the following error:
Exception of type 'System.UnauthorizedAccessException' in AlphaFS.dll
 
sure you have enough privilege to access this resource
 

2010/10/12 normalex <notifications@codeplex.com>

From: normalex

Could you please provide more details about what exactly are you trying to do?

Read the full discussion online.

To add a post to this discussion, reply to this email (alphafs@discussions.codeplex.com)

To start a new discussion for this project, email alphafs@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Oct 13, 2010 at 3:20 AM

Is it the previous release or the current development branch?

Oct 13, 2010 at 3:28 AM
 
is the Beta version
AlphaFS.dll v 1.0.9155.0
AlphaVSS.WinXP.x86.dll  v.1.0.9156.0
 
 
 
if there are other versions, I pass the link, please


2010/10/12 normalex <notifications@codeplex.com>

From: normalex

Is it the previous release or the current development branch?

Read the full discussion online.

To add a post to this discussion, reply to this email (alphafs@discussions.codeplex.com)

To start a new discussion for this project, email alphafs@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Oct 13, 2010 at 9:49 AM

This is because you are trying to copy folders instead of regular files.

Oct 13, 2010 at 1:51 PM

What I want is to copy a file to another folder, or copy a folder and all subfolders to another folder. you have some example that I can help.?
 
Because now the example I have to copy a file to a folder tells me not sindo exixte the file if there.
Corrected code again left with what you said to me:

Imports

Alphaleonis.Win32.Filesystem

Imports

Alphaleonis.Win32.Vss

Imports

Alphaleonis.Win32.Security

Imports

System.IO

Public

Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim snap_path As String = "D:\SHAW\TAREAS.xlsx"

Dim backup_path As String = "C:\BACKUP\"

''

If Alphaleonis.Win32.Filesystem.File.Exists(snap_path) Then

              Alphaleonis.Win32.Filesystem.File.Copy(snap_path, backup_path)

End If

End Sub

End

Class

 

ERROR: Directory not found:D:\SHAW\TAREAS.xlsx

 

THANK YOU


 
2010/10/13 normalex <notifications@codeplex.com>

From: normalex

This is because you are trying to copy folders instead of regular files.

Read the full discussion online.

To add a post to this discussion, reply to this email (alphafs@discussions.codeplex.com)

To start a new discussion for this project, email alphafs@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Oct 13, 2010 at 7:37 PM
The File.Copy method works on single file instances and cannot
recursively copy whole folders.
The correct form is to specify a source file name and a destination
file name, not a folder.

We are working on introducing Directory.Copy method that will copy
directories, but for now you can try write your own copy function.
It's pretty easy. I recommend you to utilize
Directory.GetFullFileSystemEntries(string directory, string
searchPattern, SearchOption searchOption) method to enumerate
directory and then use File.Copy for each individual file.



Sincerely,
Alexandr N



On 13 October 2010 05:51, ingcasv <notifications@codeplex.com> wrote:
> From: ingcasv
>
> What I want is to copy a file to another folder, or copy a folder and all
> subfolders to another folder. you have some example that I can help.?
>  Because now the example I have to copy a file to a folder tells me not
> sindo exixte the file if there.
> Corrected code again left with what you said to me:
>
> Imports
>
> Alphaleonis.Win32.Filesystem
>
> Imports
>
> Alphaleonis.Win32.Vss
>
> Imports
>
> Alphaleonis.Win32.Security
>
> Imports
>
> System.IO
>
> Public
>
> Class Form1
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>
> Dim snap_path As String = "D:\SHAW\TAREAS.xlsx"
>
> Dim backup_path As String = "C:\BACKUP\"
>
> ''
>
> If Alphaleonis.Win32.Filesystem.File.Exists(snap_path) Then
>
>               Alphaleonis.Win32.Filesystem.File.Copy(snap_path, backup_path)
>
> End If
>
> End Sub
>
> End
>
> Class
>
>
>
> ERROR: Directory not found:D:\SHAW\TAREAS.xlsx
>
>
>
> THANK YOU
>
>
> 2010/10/13 normalex <[email removed]>
>
> From: normalex
>
> This is because you are trying to copy folders instead of regular files.
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on CodePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at CodePlex.com
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Oct 15, 2010 at 2:15 PM
have some sample code to copy a file from one folder to another, which could guide me to make a backup project. I have been testing but I have worked I've done.

 
2010/10/13 Normalex <notifications@codeplex.com>

From: Normalex

The File.Copy method works on single file instances and cannot
recursively copy whole folders.
The correct form is to specify a source file name and a destination
file name, not a folder.

We are working on introducing Directory.Copy method that will copy
directories, but for now you can try write your own copy function.
It's pretty easy. I recommend you to utilize
Directory.GetFullFileSystemEntries(string directory, string
searchPattern, SearchOption searchOption) method to enumerate
directory and then use File.Copy for each individual file.



Sincerely,
Alexandr N



On 13 October 2010 05:51, ingcasv <notifications@codeplex.com> wrote:
> From: ingcasv

>
> What I want is to copy a file to another folder, or copy a folder and all
> subfolders to another folder. you have some example that I can help.?
>  Because now the example I have to copy a file to a folder tells me not
> sindo exixte the file if there.
> Corrected code again left with what you said to me:
>
> Imports
>
> Alphaleonis.Win32.Filesystem
>
> Imports
>
> Alphaleonis.Win32.Vss
>
> Imports
>
> Alphaleonis.Win32.Security
>
> Imports
>
> System.IO
>
> Public
>
> Class Form1
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>
> Dim snap_path As String = "D:\SHAW\TAREAS.xlsx"
>
> Dim backup_path As String = "C:\BACKUP\"
>
> ''
>
> If Alphaleonis.Win32.Filesystem.File.Exists(snap_path) Then
>
>               Alphaleonis.Win32.Filesystem.File.Copy(snap_path, backup_path)
>
> End If
>
> End Sub
>
> End
>
> Class
>
>
>
> ERROR: Directory not found:D:\SHAW\TAREAS.xlsx
>
>
>
> THANK YOU
>
>
> 2010/10/13 normalex <[email removed]>

>
> From: normalex
>
> This is because you are trying to copy folders instead of regular files.
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])

>
> To start a new discussion for this project, email
> [email removed]

>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on CodePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at CodePlex.com
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])

>
> To start a new discussion for this project, email
> [email removed]

>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.

>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (alphafs@discussions.codeplex.com)

To start a new discussion for this project, email alphafs@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Oct 16, 2010 at 12:12 AM
 
The example I need is to copy a file in use, or hot
 
Oct 16, 2010 at 6:30 PM

Sure, i'll write an example for you about it today.

Oct 17, 2010 at 10:37 AM

Here is the requested example.

To understand it, take a look at http://tranxcoder.wordpress.com/2010/01/26/using-volume-shadow-services-to-copy-locked-files/

and nice getting started demo from "lojikl", http://www.fungusware.com/files/alphavss_demo.zip

You need to reference AlphaVSS.Common and AlphaFS libraries.

To effectively debug such samples you need to start VS with Admin rights in Vista and 7 (right mouse click on VS 2008 or 2010), otherwise you'll get access denied exceptions.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Alphaleonis.Win32.Vss;

namespace testAlpha
{
    class Program
    {
        static void Main(string[] args)
        {
            string source = @"C:\Users\Mamba\AppData\Local\NVD\{20140062-0062-0409-0000-0000000FF1CE}\Microsoft\Outlook\mamba@gmail.com.pst";
            string dest = @"C:\Temp\my backupMails.pst";

            IVssImplementation imple = VssUtils.LoadImplementation();
            using (IVssBackupComponents bcomps = imple.CreateVssBackupComponents())
            {
                bcomps.InitializeForBackup(null);
                bcomps.SetBackupState(false, false, VssBackupType.Full, false);
                using (IVssAsync operation = bcomps.GatherWriterMetadata())
                {
                    operation.Wait();
                }

                Guid snapSet = bcomps.StartSnapshotSet();
                string root = System.IO.Directory.GetDirectoryRoot(source);
                Guid gsnap = bcomps.AddToSnapshotSet(root);

                using (IVssAsync operation = bcomps.PrepareForBackup())
                {
                    operation.Wait();
                }

                using (IVssAsync operation = bcomps.DoSnapshotSet())
                {
                    operation.Wait();
                }

                VssSnapshotProperties snapProperties = bcomps.GetSnapshotProperties(gsnap);
                string sVssFile = source.Replace(root, snapProperties.SnapshotDeviceObject + @"\");
                Alphaleonis.Win32.Filesystem.File.Copy(sVssFile, dest);
                bcomps.DeleteSnapshotSet(snapSet, true);
            }
        }
    }
}