Error Access denied to programmatically created folder - sharepoint-2010

I Have Created document set in that document i have programmatically created an Tempfolder but when i access that folder it shows error like"Access to the path 'C:\Users\Administrator\AppData\Local\Temp\MyTempFolder' Access is denied"
please guide me.

It is correct behavior because you need administrator's rights to access that folder.
The simples solution is to run you program as Administration but I would rather change the folder, otherwise you need to elevate the rights of you app.
Furhter you can look here and here.

Related

Unable to list folders when using scoped app permission for Dropbox

I'm able to successfully list folder and contents when my dropbox developer app has full access, however, when I'm using scoped access only to a specific folder, it fails.
Now when I switch to scoped access to a specific folder I'm running into errors. This request should fail since the app does not have access to the folder.
Now when I put in the right folder path, I'm still getting the same error.
For reference I'm sharing my app details
It looks like you're using the App Folder permission. This will root all your paths relative to that app folder; your app will not be able to see outside of it.
For example, if the user sees the file as "/Apps/AppFolderAccess/myfile.txt", your app will see it as "/myfile.txt". By setting your path to /Apps/AppFolderAccess, it is effectively resolving as /Apps/AppFolderAccess/Apps/AppFolderAccess - which is not found.
If your application needs to see content outside its app folder, you should select full access.
Building on top of the other answer: you need to set the application permission to access type "Full Dropbox– Access to all files and folders in a user's Dropbox."
However, note that this requires you to delete your existing app and create a new one since it is not possible to change the scope of an existing app.

VB.NET Permission to access local user's folders

In my VB.NET app, an AD user(timmy) can login and access his exchange a/c through Outlook. Outlook is launched using a Process.
When user tries to double click an attachment of PDF file, Edge being and to-be the default PDF viewer opens up but fails to load the file. It shows error message :
The reason I can think of is: user timmy doesn't have access to user cbembinster's local files.
How can I give access to timmy to access local user's files and folders ?
Can anyone give any idea on how to solve this problem. Any help is highly appreciated.
Thanks

system.unauthorizedaccessexception access to the path ..... is denied

I am running a system.xml.xmltextwriter() method in vb.net and everytime it tries to run i get a "system.unauthorizedaccessexception access to the path (FilePath) is denied."
I have been to through this file path giving all folders and the file full control access rights to "Everyone" (i know you shouldn't from a security point of view but i'm just trying to solve the problem at the moment).
If anyone has any other ideas as to what the problem could be it'd be much appreciated

SharePoint 2010 Foundation site Read permission list item contribute permission not working

I've upgraded a SharePoint WSS 3.0 farm to SharePoint 2010 Foundation.
Now I got a strange problem in a web part that modifies and creates Content Library files.
The user is only allowed to modify a file if he also got Contribute/Full access on site level (might be enough to have these permission on List/Library but I haven't tried). The user already got contribute permissions on the parent folder and on the file (inherits).
Another problem on the same site but on a different Library. All users on the site can read all files in this Library but when i try to copy a file from one list to another using the following code i get access denied when OpenBinaryStream is executed.
SPFile newFile = SPContext.Current.Web.Lists["ToLibrary"].RootFolder.Files.Add(folder + "/default.aspx", oldFile.OpenBinaryStream());
Both the problems only occurs on the upgraded farm and works fine on the WSS 3.0 farm.
Does anyone have any idea what's going on?
I had a similar issue which turned out to be a setting for lists/libraries. In the Advanced Settings for a list/library, there is a section labeled "Item-Level Permissions" - this setting can be used to deny access for anyone without Full Control rights to the item. Unless there is a specific need, Read Access should be set to Read all items and Create and Edit access should be set to Create and edit all items.
I had the same issue and resolved it by going to Site Settings > Edit Permission Level > and giving the 'Contribute' permission level the ability to 'Open Items - View the source of documents with server-side file handlers'

Why does accessing files in AppData (on Vista) require admin rights?

My application (vb.net) sometimes throws an "access denied" exception when attempting to delete files in the AppData folder and I'm not sure why.
I confirm that the file exists before attempting to delete it and have not done anything to make it readonly, etc.
The interesting thing is that it seems to go okay when I'm logged in with Admin rights. However, I thought that the AppData folder did not require admin rights.
Any help would be greatly appreciated!
Thanks!
My gut instincts without seeing your code is that maybe you have this file opened in your program or in another program?
Maybe these files were created when you launched your application being logged on as Admin? So you get this error when you try to delete them later as normal user.
It is not necessarily the folder, but the Owner of the file you are trying to interact with. If the File is owned by Administrators, you may have problems.
AppData is a protected hidden folder because it is meant for your applications to store Local, LocalLow and Roaming application related data. This is why you would get prompted with a UAC prompt when you try to head into the folder and it is also hidden from view.
Try to use the Privilege demand attribute in your code to request process elevation to access the folder.