I'm working on a C# project with these requirements:
Download an Office (Word, Excel or PowerPoint) document from the cloud
Change footers and headers of the document using Open XML SDK
Upload the document back to the cloud
In case, there is some one else editing the document at the some time, will his changes (or mine) be lost?
How can I sync between changes without loosing none of them?
Assuming you're using the OneDrive API to download and upload the documents, you can use an If-Match header on the upload to make sure that you will not overwrite anyone else's changes (See this page for details).
If you're using either the MS Graph SDK or the OneDrive SDK you can provide the header via the HeaderOption object when you invoke the request builder's Request method.
In the event that the upload does fail with a 412 Precondition Failed you'd need to download the file again, make your changes, and attempt another upload.
Related
I want to trigger a flow whenever a file is added to a Sharepoint folder.
When using the "When a file is created in a folder" trigger, the flow is triggered if I upload a new file from the Sharepoint Web UI or if I save a new file into the synced folder on my computer.
But if I copy/paste or move a file from my computer's filesystem to the Sharepoint synced folder, the flow isn't triggered.
This is expected behavior and it is by design it seems.
Files uploaded to SharePoint have a modification date of today
and the document that I copied locally and Synced to
SharePoint kept their original date. ...
A lot of the Flow technology
depending on web hooks and one of the things webhooks does is use a
last change token. This is to ensure that you only pickup changes
since a certain date.
... make sure that you upload document to SharePoint rather than
synchronising document to SharePoint.
Uploading documents to SharePoint using OneDrive/Sync and Microsoft Flow ignores these
Author in comment:
I’ve not found a solution for this yet. The only real option at the moment is to use a recurring flow.
I develop a Javascript Office add-in which can run on Word, Excel and PowerPoint.
One of the features of the add-in is to suggest user to upload current file to our server if the file have changed and/or saved since the last successful upload.
I had some luck with document.properties.lastSaveTime for Word application: https://dev.office.com/reference/add-ins/word/documentproperties?product=word
But this API is Word-specific and is not available for other hosts.
Is there a way to get the date of last file change (document, workbook and presentation accordingly to the host application) using shared API, that is, API available for all three hosts?
If such shared API functionality doesn't exist, even some clue of how to get last changed date of individual hosts' files would be helpful.
Office 365 / Sharepoint Libraries
OneDrive for business Client
Windows 7
I was testing out Syncing capabilities of OneDrive for business client for users with only Read-Only permissions.
When a user has Read-only permissions the Sync button on the Sharepoint library site does not show itself. But I was able to copy the URL and manually Sync the library through the OneDrive for business client.
When doing this, the folder will Sync to the local client.
If the user deletes a file, it will temporarily be deleted out of the client's sync folder, but it does not delete from the Sharepoint library.
The next time it syncs, the file will be pulled back down to the client, but this time without a green check indicating fully synced (it looks like a regular file in the folder).
If the user deletes the file again, the next Sync cycle will NOT pull the file back to the client.
I tried editing the file once in the Sharepoint Library as the next step, and the File synced back to the client.
If the client deleted it, it would not get pulled back to the client.
If I tried editing, or overwriting the file the problem was not resolved.
If I un-synced and re-synced the library the problem is rectified.
My question: Is this working as intended? Or is there a proper sequence of events to always force the file to be re-uploaded to the client?
Thanks,
Dennis
I have a silverlight application inserted in a SharePoint page. The SilverLight application runs on a different server thatn that of SharePoint. From an event in the SilverLight, I generate a document on the server side from SQL Server. I can generate the doc on the server hosting the silverlight application and also copy it to the SharePoint server. I wanted to know if I can include this file in a sharepoint document library automatically. I was thinking if like emailing to a list allows us to copy the file into the library, can we configure the reverse, means copying the file make it part of the list.
Update:
I wanted to avoid uploading. For me uploading is sending the file from one location to the target location. But what I am saying is, if I copy the file into the folder where SharePoint keeps the file physically for the particular list, can it be added to the list automatically?
I am not sure, how well I am being able to describe the point. Please elaborate if required or I can answer your queries.
SharePoint stores the files in a database, not a folder.
WebDAV access may be what you're looking for - it's a backbone of the the Explorer View feature that allows a user to access a document library as if you were accessing a file system through a Windows Explorer window.
You can configure "incoming e-mail" properties for the document library, and assign an e-mail address.
After that, when you e-mail a document as attached to e-mail to this e-mail address, then attachment will be saved to that library by sharepoint automatically.
We have a requirement to store documents in SharePoint Online as people copy files to a shared network directly.
Is there a way of automating this? I was thinking of a windows service which will poll the directories, find any changes like new subdirectories or new files, then upload them to a SharePoint Online document library.
You don't have to poll if you use a FileSystemWatcher inside your Windows service for real-time notifications.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
However, if your requirement is 100% accuracy, you will need to build in some sort of tracking/checksum mechanism to make sure that every document was 1) detected and 2) successfully moved to SharePoint.
You may want to have your service check the delta every time it starts up, and then subsequently only respond to FileSystemWatcher events.
EDIT: Per Tony's question below, here are some additional thoughts on getting files to SharePoint.
First, try a simple test.
1) Copy the URL of a document library within the BPOS SharePoint site. Make sure you're on a machine that has the Office Online sign in app on it.
2) Open Notepad. Type some random text.
3) Click on File -> Save As.
4) Paste the URL.
5) Attempt to save the file.
This works great on "regular" SharePoint (done it many times). If this works with BPOS, it opens up several options.
File System Replication to a SharePoint Online or Office 365 document library is planned to be released with the "Cloud Connector for Office 365". With the current version database content is supported only, but bi-directional with V2.0