
Microsoft Teams: How to Enable Guest User Access?. How to Copy Permissions from One Folder to Another in SharePoint Online using PowerShell?. How to Connect to Exchange Online using PowerShell?. SharePoint Online: Switch Navigation to Horizontal or Vertical. Hide a Button in SharePoint Online List or document library Toolbar. Switch between Document Libraries with Document Library Dropdown Menu in SharePoint Online and OneDrive. This is occurring at the ExecuteQuery() statement in GetDocumentLibrary(), I don't understand why it isn't returning any results, as I've changed the clientcontext and web to point to the new URL to query instead of the one pointing at documents.ĭoes anyone have any idea why it's looking for /_vti_bin/sites. There is no Web named "/personal/firstname_lastname_mycompany_com/Documents/_vti_bin/sites.asmx" An unhandled exception of type '' occurred in Īdditional information: Cannot contact site at the specified URL If I try to run the same code above, this time I get the following exception thrown. This code works fine for returning a list of folders within the Documents folder, however, my problem is trying to list the contents of one of these folders.
Var list = GetDocumentLibrary(libraryName, clientContext, web) Public List ListFolders(string libraryName, ClientContext clientContext, Web web) Var query = clientContext.LoadQuery((p => p.Title = libraryName)) Public List GetDocumentLibrary(string libraryName, ClientContext clientContext, Web web) now do something with results contained in 'folders' Var folders = ListFolders(dirPath, clientContext, web) Here's an example of listing the folders within Documents. I can successfully list all the folders in the root of Documents and download all the files in the root of the Documents folder. I am also of the impression OneDrive For Business differs enough (with it's entanglement in Sharepoint) from OneDrive.
For backup purposes (as users are wonderful at accidentally deleting things they shouldn't) I'm trying to write some software to download the contents of my company's users "One Drives" to the company network so we can back them up, in case they delete anything.