locked
Failing to export with Export-SPWeb RRS feed

  • Question

  • I first executed gcm -pssnapin microsoft.sharepoint.powershell | select Name, Definition | fl > F:\sp2010cmdlets.txt on the Sharepoint managment console.

    Then, I have a webapplication at http://servername:portnum  and a site collection /sites/sitecol1 (i.e. the full site collection URL is http://servername:portnum/sites/sitecol1 )

    I'm trying to export one document library from that site collection named testlibrary but it always fails

    I tried
    Export-SPWeb http://servername:portnum -itemurl "/sites/sitecol1/testlibrary" -path "D:\Backups\testBK.cmp"

    But I get

    Export-SPWeb : The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using stsadm.exe.

    I also tried using the -Identity before the first url, but I get the same error. Is it posible to export at that level?

    Thanks!

    Wednesday, April 6, 2011 7:57 PM

Answers

  • Ok. Finally got it.

     

    Export-SPWeb http://server:port/sites/a_site/ -ItemUrl "/sites/a_site/a_library" -Path "D:\Exports\a_site_a_library"

    I had to put the URL up to the site collection level, and in the ItemURL repeat the site collection url part.

    The only issue is that even if on ItemUrl you go deeper (like a subfolder of the library) it exports the whole document library. I don't think it's possoble to export a document library subfolder via commandline?

    • Marked as answer by diegochb Friday, April 8, 2011 2:16 PM
    Friday, April 8, 2011 2:16 PM

All replies

  • did you try the full url for -itemurl property ?
    Wednesday, April 6, 2011 8:55 PM
  • In the sharepoint central admin -> Application Management -> Configure Alternate Access Mappings

    Here you will need to make sure that your servername is listed or you will recieve the error you mentioned.

    Also you have the option to use Backup-SPSite which will perform a more complete backup of your entire site collection.

    Hope this helps


    Allan Merolla | BEng, JD, MCP | .NET/Sharepoint | My Blog at http://www.parallelfun.com/
    Wednesday, April 6, 2011 10:41 PM
  • yes, with the same error

    Thanks!

    Thursday, April 7, 2011 2:25 AM
  • Thank you! I will try adding the alternate mapping.

    I didnt use the other option because I want to target smaller items since site collection can be over 100GB (current one is)

     

    Thank you! (I will reply with the result)

    Thursday, April 7, 2011 2:27 AM
  • In the sharepoint central admin -> Application Management -> Configure Alternate Access Mappings

    Here you will need to make sure that your servername is listed or you will recieve the error you mentioned.

    Also you have the option to use Backup-SPSite which will perform a more complete backup of your entire site collection.

    Hope this helps


    Allan Merolla | BEng, JD, MCP | .NET/Sharepoint | My Blog at http://www.parallelfun.com/


    You mean if I have http://servername:pornum/ as the web application add http://servername/ to alternate mapping, right?

    Thanks!

    Thursday, April 7, 2011 3:06 AM
  • It did already have the alternate mapping with the server name. :(
    Thursday, April 7, 2011 2:05 PM
  • Anyone with any suggestion as why

    Export-SPWeb http://servername:portnum -itemurl "/sites/sitecol1/testlibrary" -path "D:\Backups\testBK.cmp"

    or

    Export-SPWeb http://servername:portnum -itemurl "http://servername:portnum/sites/sitecol1/testlibrary" -path "D:\Backups\testBK.cmp"

    don't work? Alternate mapping with server name already setup... still gives error

    Export-SPWeb : The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using stsadm.exe.

    But I thought this command could be used to BK a list or library. Is there another command to do that?

    Friday, April 8, 2011 1:01 PM
  • Ok. Finally got it.

     

    Export-SPWeb http://server:port/sites/a_site/ -ItemUrl "/sites/a_site/a_library" -Path "D:\Exports\a_site_a_library"

    I had to put the URL up to the site collection level, and in the ItemURL repeat the site collection url part.

    The only issue is that even if on ItemUrl you go deeper (like a subfolder of the library) it exports the whole document library. I don't think it's possoble to export a document library subfolder via commandline?

    • Marked as answer by diegochb Friday, April 8, 2011 2:16 PM
    Friday, April 8, 2011 2:16 PM
  • The lowest granular level you can export is either a list or library.

    You cannot export a folder with in a library using ExPort-SPWeb.

    You have to use third party tools or powershell to do that.

    Thursday, December 15, 2011 10:31 PM
  • hi diegochb

     

    this command works

    Export-SPWeb http://servername:portnum -itemurl "/sites/sitecol1/testlibrary" -path "D:\Backups\testBK.cmp"

     

    thanks

    Friday, February 3, 2012 6:25 AM