Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Content back up and Restore

Content back up and Restore

Scheduled Pinned Locked Moved SharePoint
helptutorial
2 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anil0312
    wrote on last edited by
    #1

    Can i know how to take backup for content.I am sending my code also. I am writing code on web service. [WebMethod] public void downloadArcive(string SiteUrl, string ContentName) { SPSite site = new SPSite(SiteUrl); SPWeb web = site.OpenWeb(); SPFolder myFolder = web.GetFolder(ContentName); SPFileCollection myFiles = myFolder.Files; String backupLocation = "c:/Bin"; String backupfile = "http://ak-vpc/sites/governance"; UInt64 diskFreeSize = 0; UInt64 diskSize = 0; foreach (SPFile file in myFiles) { if (file.Length > 1) { for (int i = myFiles.Count - 1; i > -1; i--) { myFiles[i].MoveTo(backupLocation, true); //I am getting error.............. :zzz: } } } } i am getting error .Please help where i did mistake.

    A 1 Reply Last reply
    0
    • A Anil0312

      Can i know how to take backup for content.I am sending my code also. I am writing code on web service. [WebMethod] public void downloadArcive(string SiteUrl, string ContentName) { SPSite site = new SPSite(SiteUrl); SPWeb web = site.OpenWeb(); SPFolder myFolder = web.GetFolder(ContentName); SPFileCollection myFiles = myFolder.Files; String backupLocation = "c:/Bin"; String backupfile = "http://ak-vpc/sites/governance"; UInt64 diskFreeSize = 0; UInt64 diskSize = 0; foreach (SPFile file in myFiles) { if (file.Length > 1) { for (int i = myFiles.Count - 1; i > -1; i--) { myFiles[i].MoveTo(backupLocation, true); //I am getting error.............. :zzz: } } } } i am getting error .Please help where i did mistake.

      A Offline
      A Offline
      Alain Lord
      wrote on last edited by
      #2

      Hi, Why are you using this technique for backup? There are several alternatives to perform a more solid and consistent backup of your content. Create a simple batch file on the server and use stsadm -o backup. As for your specific error, it's probably because the backuplocation is not a SharePoint library the Move operation expect a SharePoint library as operator. See the API documentation (here's an extract) The MoveTo method moves files to another location within the same site. This method returns an error if a file of the same name already exists at the new location. Hope this helps! Regards, Alain Lord MVP SharePoint Server SharePoint Quebec User Group Lead

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups