I have a line:
ThisWorkbook.SaveCopyAs Filename:="https://pmicloud-my.sharepoint.com/personal/yisaev_grintl_net/Documents/Book2.xlsm"
It returns an error:
"Sorry we couldn't find path [path string here]. Is it possible it was moved, renamed or deleted?"
Function .SaveCopyAs works with the path on a computer drive, but not with web site like SharePoint, when other options (Workbooks.Open and Workbooks.SaveAs) work with the same path to SharePoint.
Well excel wants to save the file to a hard drive. Saving to an URL is not the same thing.
The SharePoint URL is a web interface displaying data on a network drive. If you have access to that network drive you can directly save the file there.
Otherwise you will have to save the file and upload it manually.
Obviously Microsoft added some support for sharepoint over http(s), but it does not support the .SaveCopyAs method:
You can vote for this feature here:
Improve *Workbook.SaveCopyAs VBA method - support SharePoint / OneDrive
Related
I've been searching and searching but with no luck. Is there a way to use Excel VBA to import master file data from another excel workbook saved in OneDrive?
Thanks in advance.
A.) If you have an excel workbook that is stored locally on your PC but inside your OneDrive sync-ed folder.Then you can use following VBA code to approach one drive file. Once file is available there are many routines already on SO to import data.
Sub Test()
Dim fn As String
fn = "Your File " 'change file name
fn = Environ("onedrive") & "\" & fn
'check to see if it exists
If Len(fn) > 0 Then
Debug.Print fn
End If
'... do something.......
End Sub
B.) FETCH FILES If you have the OneDrive desktop app for Windows installed on a PC, you can use the Fetch files feature to access all your files on that PC from another computer by going to the OneDrive website. You can even access network locations if they're included in the PC's libraries or mapped as drives. When you browse a PC's files remotely, you can download copies of them to work on. You can also stream video and view photos in a slide show. To access files on your PC remotely, make sure the PC you want to access is turned on and connected to the Internet. OneDrive also needs to be running on that PC, and the Fetch files setting must be selected. For further Details please refer Fetch files on your PC
C.) FIle on ShareOint - VBA aopproach If your file is on SharePoint. OneDrive doesn't sync the shared files to the local and sync. In such case VBA code is available on SO VBA download a File from OneDrive by #Sid29
D.)REST APIs - Microsoft Graph Another situation is elaborated in the following paragraph which uses API.
The OneDrive REST API is a portion of the Microsoft Graph API which
allows your app to connect to content stored in OneDrive and
SharePoint. The REST API is shared between OneDrive, OneDrive for
Business, SharePoint document libraries, and Office Groups, to allow
your app the flexibility to read and store content in any of these
locations with the same code.
These REST APIs are a part of the Microsoft Graph, a common API for Microsoft services.
For existing solutions using OneDrive API outside of Microsoft Graph, or solutions targeting SharePoint Server 2016, see direct endpoint differences for more context on reading this documentation. OneDrive and SharePoint in Microsoft Graph
E.) It may be difficult to get url of specific online file of onedrive. Microsoft Community has covered a situation where they have suggested VBA code for downloading of a file without URL.It is report xlsx from a web application.
Because the URL isn't the path to the file, it's a 'file request link' it processes single sign on verification, then the download popup is displayed.
Though it depends on the web site , code mentioned in article executed successfully using IE browser. Code mentioned in this article can be experimented with. There is no other method to load online onedrive file through VBA in my knowledge.
When you browse a list of files in Sharepoint using IE and attempt to download the file, you get the option of opening it in read-only or edit mode. When you open the document, Office knows that the file exists in Sharepoint so when you save, it is updated in Sharepoint without the user having to re-upload the file.
I'd like to have this same functionality in a custom website. I have access to Sharepoint and the file list so I'm using the same URL that Sharepoint is to download the file but there's something else happening in Sharepoint that tells the computer to not download a copy of the file but to open it in Office from the Sharepoint URL.
Does anyone know how to mimic this same behavior so I can get a file to be opened in Office from Sharepoint to it can save directly back to Sharepoint?
The special thing about this, is the link:
It's not just http://example.com/document.docx . It's ms-word:ofe|u|http://example.com/document.docx .
Just add ms-word:ofe|u| in front of the link for letting the browser know to open the link with an other Application.
There are other strings for other links.
Open a OneNote-File with:
onenote:http://example.com/document.one
And Excel-Files with
ms-excel:ofv|u|http://example.com/document.xlsx
And just for fun a TeamSpeak Link:
ts3server://example.com
Create URL for MS Office 2010 (and higher) to:
open document in view mode:
ms-excel:ofv|u|http://server.com/path/filename.xlsx
open document in edit mode:
ms-excel:ofe|u|http://server.com/path/filename.xlsx
List of MS Office apps URL scheme names:
ms-word:
ms-powerpoint:
ms-excel:
ms-visio:
ms-access:
ms-project:
ms-publisher:
ms-spd:
ms-infopath:
MS has a good page with explanation:
MS Office Dev Center > Office URI Schemes
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.
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.
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