3

I want to create a temporary folder in my local system and upload file into that particular folder as ZIP.

Note: the file path is getting from SharePoint document library

Thanks in advance

  • `System.IO.Directory.CreateDirectory(System.IO.Path.GetTempPath() + "WhateverFolderName");` ? – blaze_125 Mar 22 '17 at 13:08
  • You mean *download* from a SharePoint library? Upload means that you'll send a file from your local system to the library. Why don' you ask the *user* where to store the folder? A user would prefer to store a folder in his `Documents` folder instead of looking into Temp – Panagiotis Kanavos Mar 22 '17 at 13:14
  • For Downloading multiple files as zip from a Subfolder of Sharepoint library i am creating a temporary folder in the temp folder in the system, and copying files from the subfolder to temporary folder through code.Now i Want to download files in the temporary folder as zip folder.Now i am getting error C:\inetpub\wwwroot\wss\VirtualDirectories\4444\TemporaryFolder – Neenu Surendran K Mar 23 '17 at 08:09
  • Forgive my ignorance on this one but... isn't `C:\inetpub\wwwroot\...` protected area where elevated permissions are required to do anything? Be more explicit about the "new error" and put that up in your opening post. – blaze_125 Mar 23 '17 at 12:53

1 Answers1

9

This will create a temporary directory:

   string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
   Directory.CreateDirectory(tempDirectory);
Václav Struhár
  • 1,739
  • 13
  • 21