Download whole directory(folder) from sharepoint using vba-excel - excel

I want to download all the files that are under:
http://sharepoint.company.com/sites/Some Site/Some Directory
to a local directory with vba and excel. I found another question and their answers were saying that I need to map this directory to a drive but I am not able to do so. I know how to download a file from that directory if I know the name of the file but I can't download the whole directory.
Is there a way of doing that?
Thanks!

Unfortunately, the WebDAV (Explorer view) interface is not usable by the normal FileSystemObject
See this similar question
Get the content of a sharepoint folder with Excel VBA
The this link from here has some code that hacks into WebDav using ADO...
An interesting take on the solution.

Related

Reading data from shared teams text file using VBA in Excel

I have created a tool using VBA that performs several pulls from BigQuery and does a variety of transformations and summarization inside of Excel. The tool is an evolving tool and to make sure that the users are using the most current version of the tool, I would like to have a version file saved on the shared Teams page that the tool would check and if needed, download the newest version onto the tool to the user's folder. I have scrubbed the web for several solutions to this ask but not one that actually works. Below are the links to the solutions I have attempted. The issue is that the connectors for opening text files seem to not work with a URL from Teams. I need to know how to make this work. Any help would be greatly appreciated.
https://www.excel-easy.com/vba/examples/read-data-from-text-file.html
This solution doesn't seem to work with a URL as I get a Bad Filename error.
https://chandoo.org/forum/threads/download-file-from-sharepoint-and-save-it-in-system-folder.41779/
Problem with this one is that the download for some reason shows completed but actually never moves local.
Connecting to Excel file stored on SharePoint via ADODB
https://www.connectionstrings.com/textfile/
I attempted to use this solution using the text file connection string but was not successful here either.
https://www.exceltip.com/import-and-export-in-vba/import-data-from-a-text-file-ado-using-vba-in-microsoft-excel.html
Again, another bad name error.
Any help or advice on how to connect to a simple text file shared in a Teams folder would be greatly appreciated.

copy files from SharePoint to SFTP

Is there a way to copy SharePoint document library files to SFTP? I tried opening windows Explorer (with the help of swich) for SFTP and also had library opened in explorer mode. I can drag hand full of documents and move a across. but I can't copy 50,000 items from the document library to sftp. I tried copy and paste and nothing happens. May be a powershell way? or any other way?
Actually, I solved the problem with non-coding approach.
Mapped "\intranet.domain.com\siteCollection\DocumentLibrary" to S:
Used WinSCP to upload Y: to Remove ftp.
Thanks

How to create Sharepoint ONET file

I was trying to find any tool that I can use to create ONET file from the existing SharePoint site. Unfortunately wasn't able to find. Does anybody know anything about that? There should be something besides of manual way to do that... Any MS solutions, third party tools?
As John Saunders is alluding, the simplest approach would be to let SharePoint create it for you. It's not exactly sitting in the site though; you can't just open the site in SharePoint Designer & grab it - but there is a way to get it:
Save the site as a Site Template (with or without content, doesn't matter - but without will be faster/smaller)
Download the STP/WSP from the Site Template (SP2007)/Solutions (SP2010/13) Gallery to your desktop
Change the file extension to .CAB
Use an archive tool (i.e. 7-zip) to unpack the CAB file
Within the unpacked CAB you will see a folder whose name will be the original name of your Site Template + "WebTemplate"
Within that folder will be a sub-folder whose name is just the original name of your Site Template
Within that folder is the ONet.xml file

Adding file to WSS 3.0 document library without GUI

OK I am new to working with SHarePoint Services and have an issue that I am trying to overcome. Where I work, I have implemented a Crystal reports Scheduler that outputs the reports to a shared folder. What I am trying to accomplish now is finding a way that I can point the output of the scheduler to the document library. I was hoping that I could find it like any other shared folder.
On your box hosting sharepoint, turn on the WebClient Service.
Goto the library you wish to upload to, drop down on actions-> open in windows explorer
The path you see can be converted to a UNC path, where you can use it like any other shared folder.
To convert, it should look like \\servername\Shared Documents
This unc can be mapped as a shared folder like any other physical networked folders.
Happy Uploading!
If you want to upload the file in your code (not manually) without mounting a WebDAV share, you can also HTTP-PUT it to the desired URL, for example http://myserver/sites/mysite/mysubsite/mylist/myfolder/foo.doc
Try the code in this question: Uploading files to Sharepoint (WSS 3.0) document library using HTTP PUT
With the tip in this answer: Uploading files to Sharepoint (WSS 3.0) document library using HTTP PUT.

Upload files to Sharepoint document libraries via FTP

I was wondering if anyone knows how to or if it is possible to upload files to a sharepoint (v3/MOSS) document library over FTP. I know it is possible with webdav. If it is possible is this even supported by Microsoft?
I don't think so. I think your options are:
HTTP (via the upload page)
WebDAV
Web Services
The object model
You can map a drive to a SharePoint document library, for example \\serveraddress.domain.com\Documents. So I would try mapping a drive on your FTP server, then making sure files that come in over FTP get sent to that drive.
Big edit: Have any of you figured out how to upload to SharePoint (WSS)? I've tried drive mapping and then using Robocopy and Synctoy to copy files thinking a tool might offer greater control (i.e. a Copy Date Modified control). As I understand it the files are actually stored in SharePoint as database objects and therefore SharePoint views display the database object (SQL object's) properties in Document Libraries where a new user would expect to see the file properties. Those file properties are still alive! They just need to be uncovered by a different view. I particularly like the mapped network drive view of a SharePoint Document Library. File attributes are pretty important to my team, so we were concerned about that at the start. As an opinion note though, the default view showing attributes that appear as incorrect is just plain annoying!
The best solution we've come up with for doing large file migrations into SharePoint is a mapped network drive then using a tool called FreeFileSync available at SourceForge to move your files and folders. It's great because it produces verbose error messages and give a lot of control, especially for the instances that SharePoint tries to block a particular filename or file extension.
Direct FTP into SharePoint is not one of your options. You would need to have a timer job run that checks your FTP directory and uploads into the document library.
Yes it is possible.
The WebDav Redirector allows you to access webdav resources (including Share Point) via UNC path, ie \yourspserver\site\doclib. The IIS FTP server accepts UNC paths as backing storage to virtual directories.
On your ftp server, right click the ftp site in the IIS Manager and select "Add Virtual Directory". Give it a name and specify the sharepoint unc path for the physical path. You'll need to set the "connect as" user to a domain user that has access to the sharepoint folder you're connecting to.
Connect to the ftp folder and you should be able to "cd" into the directory and put/get files without issue (just confirmed it myself). The only caveat is an age old bug/feature of IISFTP, that doesn't show a virtual dir in an ls/dir command listing. The fix is to create a physical folder that mirrors the virtual directory's location. For example, if your ftp root is c:\inetpub\ftproot, then you'll need to create a dir that matches the name of your virtual dir in this location. It will then show up in an ls/dir listing but the cd command will still move into the virtual dir, not the physical dir.
You can directly SFTP/FTP into your SharePoint doc library using Couchdrop. It turns your SharePoint into a native SFTP/FTP server, you can create additional users, etc. Sing out if you need assistance more than happy to assist.
Full disclosure: I represent Couchdrop

Resources