I am developing a windows 8 app in which i am trying to read xml files from Microsoft onedrive folder. The xml files get synced from onedrive to a particular folder. But when i an trying to read these synced xml files using StorgeFile.OpenAsync(FileAccess.Read) i get the following exception:
System.Unauthorized Exception occured in mscorlib.dll
HRESULT:0X80070005(E_ACCESSDENIED)
I am able to copy these synced files to some other location and also when i copy these files to some other location and paste it back to OneDrive folder i am able to read them
Check to see if the files are blocked. Right click on file and click on properties. If you see an Unblock button press it. If you have multiple files that are blocked, you can use the following PowerShell script:
Get-ChildItem c:\users\tech360\OneDrive - Tech360\Xml | Unblock-File
Related
I need to open a kmz file from the mobile app in order to see it in google earth, So i saved the kmz file in the StreamingAssets and i copy it to the persistentDataPath, Also the file is unable to open when i copy it to this folder.
Im calling it with this:
Application.OpenURL("file://"+Application.persistentDataPath + "/CR.kmz");
I already granted the file permissions.
I dont know how to open files from the storage with code. Help.
I can't delete a pdf file from a shared drive (Windows mapped drive) from my c# Winform desktop program which runs on Windows 10 OS. The pdf file was created by Crystal Report in my c# program and when there is a revision, I need to delete the old pdf file and write the new one. I will get access denied error (HResult=0x80070005) when the program tries to delete the file. This only happens when the I try to delete it from a shared drive. If I generate the pdf file in the local drive (c:), and delete it from the local drive, then everything is find. I can manually delete the pdf file from File Explorer, but not from my c# program.
In addition, if the file is not a pdf file, then there is no problem to delete it from the shared drive.
It is weird that this only happens to pdf file or a file with .pdf extension. If I create a simple text file (test.txt) with C++ and save it in the shared drive, I can delete it without any problem. But when I create the same text file and name it as test.pdf, then I can't delete it.
HResult=0x80070005 seems only links to permission issue, but I strongly believe my case is NOT a permission issue because if the file is *.txt, then I can always delete it without any issues.
To rule out the possibility of the pdf file that may be still linked with the Crystal Report or opened by some programs, I copied the pdf file from the shared drive and save it in my local drive (c:) and wrote a simple c++ program to test if I can delete it, and it failed. Can't delete it. I can only delete it if the pdf file was created and saved in the local drive originally. And if the pdf file is copied from the shared drive to the local drive, then I can't delete it.
I would appreciate it if someone can shed some light on it.
I think (you/your app) don't Have Permission To Delete a File
Go to the folder that contains the PDF File.
Right-click on that folder and choose Properties.
Navigate to the Security tab.
Click on Edit, then click Add.
Under the Enter the object names to select box. Type
"Everyone"(without quotes) and click on Check names. Click OK.
A new window will open up with the Security tab. Under Permissions for
Everyone, check the Full control option. Select Apply and OK.
Ownership is already allowed for the folder.
Now you Can delete PDF files programmatically
Don't Have Permission To Delete a Folder
Thanks for trying to provide solutions for this problem. With a help from a friend, I finally found the root cause of the problem. It is the Norton antivirus that prevents me from deleting a certain types of files. .pdf is one of them. After I unchecked the .pdf from Norton, it works like a magic.
It is the antivirus program that prevents me from deleting .pdf file programmatically.
I am saving a file to System.Environment.SpecialFolder.Personal in Xamarin. It appears to succeed, because I can immediately pull data from the file. However, I cannot browse and find this file on my phone. Where exactly is this exclusive Personal folder?
The System.Environment.SpecialFolder.Personal type maps to the path /data/data/[your.package.name]/files. This is a private directory to your application so you won't be able to see these files using a file browser unless it has root privileges.
You can inspect these files through adb through the following commands:
adb shell
run-as your.package.name
cd files
I am developing an App for Windows Store.
I have to save a recorded media as "file1.mp3" into the Assets folder without opening the save file prompt. I used the following code
StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.CreateFileAsync(#"Assets\file1.mp3",Windows.Storage.CreationCollisionOption.ReplaceExisting);
However the system returns an "access denied" error. The file has to be saved in the Assets directory only and I do not want to use FileSavePicker. Please Help.
Thanks
Your package folder is read-only. Use your app data folders from Windows.Storage.ApplicationData.Current instead, wherein you'll find a LocalFolder and TemporaryFolder (also RoamingFolder but an mp3 would exceed the 100KB roaming limit). Then you can use either folder's CreateFileAsync.
I am having strange problem while updating my application through ftp. I am uploading files to a folder in ftp by Ipswitch WS_FTP.
I am updating files in remote folder to check my code. But it is downloading old files which were rewritten in remote folder.
Here is details. I have a folder update. Inside of this folder 2 files. version.txt and app.zip
In old files I used capital letters such as VERSION.txt, In new file small capitals.
But I can not reach new files. Why? I can reach only old files which is VERSION.txt
With app.zip the same problem, I am updating its files inside zip file. But getting old files from zip file.
PS. I am changing files inside app.zip and uploading it to remote folder but I can not reach new files inside app.zip. I can reach only old files. The problem is refreshing of files inside app.zip. Or I have problem with cache or something else?
If the server is on linux, you should note linux is file system is camel case (window is not), so in linux file.txt != FILE.txt and in windows are the same file. Hope this tips, helps.