Stop syncing an already synced SPO document library

Brass Contributor

is there a way to automate the "stop sync" button process within OneDrive for Business? AN sync can be started simply with odopen://sync? but is there a way for stopping this?

3 Replies

@m_krone I am just running into this same question myself.  I have a whole map Sharepoint script ready to go and working great for adding drives for mapping, but now I need to find a way to remove them should we ever want to revoke access to a share.
I'll have to test what removing permissions to the SharePoint does with the mapping.  Maybe if it gets an access denied against the library it will automatically remove it?
Too bad there isn't a "Stop sync" on the Sharepoint library page as it's pretty easy to derive command lines that programs are launched with.

Did you ever get this question answered?  I've seen a few other posts around the Internet asking similar things and no one seems to have an answer.

 

@AMDMan64 Unfortunately I got no help on several social and support channels.

What I implemented was:

1. Stop OneDrive process as is flushes the config after closing to the disk

2. Remove the ID and path information from the config in the onedrive folder and registry (per user)

3. Start OneDrive again and wait until its fully loaded (waiting for checking/merging files) after this the filesystemhandler will unlock the folder and files

4. I had to remove all files at first and than all folders as an normal recursive remove -Force wasnt working

 

Really crappy this whole thing but thats the way I got it to work.

I think its really sad that there is again no managed/admin interface/api or something else to handle this. Cannot imagine to use this for a company with several 1000 or 10000 emplyees....

@m_krone Thanks, that's pretty much the solution someone else is working on too.

See this post:
https://social.msdn.microsoft.com/Forums/office/en-US/072e3577-d0ff-4950-9e0b-40b037853881/starting-...

 

I am working to modify the code posted to work in my mounting script and may post it when I'm finished.  I have to write logic to read in the shares requested in the registry (I'm populating the tenantautomount key) and then compare against the config files so that any that don't exist in the registry anymore are removed.