none
Import-SPWeb returns error "Cannot find an SPWeb object with Id or URL"

    Question

  • As part of deploying a site from development server to production server I am trying to import a site using import-spweb command in the SharePoint Management Shell. However, I get the error message "Cannot find an SPWeb object with Id or URL: http://myserver/tools".

    The URL (Identity) I entered is definitely correct, I checked it over and over. I even tried importing the site simply to http://myserver and it still doesn't work. I am at a loss what could be happening. Here is the exact command I am using:

    Import-SPWeb -Identity http://myserver/tools -path \\sharedFolder\backup\Backup.cmp -includeusersecurity

    Thanks for the help.

     

    Thursday, March 24, 2011 3:15 AM

Answers

  • Thanks for doing the research Mayank. I just figured out what the problem was in my case: I didn't have enough access permissions to the SQL Server database. I tried to do the import via stsadm and the error that came up there was a bit more useful than just a "Cannot find an SPWeb object":

    Cannot open database "XYZ" requested by the login. The login failed.

    Now at least I could contact the Service Provider and get them to elevate my permissions. This solved the problem immediate and I can now import the file via PowerShell.

    Andreas.

    • Marked as answer by andreasbbbbb Friday, March 25, 2011 3:58 AM
    Friday, March 25, 2011 3:57 AM

All replies

  • Does the URL http://myserver/tools exist on your production farm? If not, then you will need to create a site in your production farm and then run the import-spweb command again.

     

    Hope this helps.


    Mayank Malik
    Thursday, March 24, 2011 3:29 AM
  • Yes it does. It actually didn't exist on the development server (I am also in the process of restructuring content on the production server). So where I exported the site from http://developmentserver/database/quotes I am now importing it into an empty site at http://myserver/tools. It shouldn't make any difference that the structure changes, should it?
    Thursday, March 24, 2011 3:33 AM
  • It does make a difference apparently. I will try a few scenarios - 1. export/import within the same site collection 2. export import across site collections 3. export/import across farms etc. I'll post my findings later.
    Mayank Malik
    • Edited by Mayank M Thursday, March 24, 2011 4:45 AM
    Thursday, March 24, 2011 4:19 AM
  • You can use the information at this link to create your own export - import utility. 

    http://msdn.microsoft.com/en-us/library/ms438819.aspx


    Mayank Malik
    Thursday, March 24, 2011 4:22 AM
  • It does make a difference.
    Mayank Malik

    Why does it make a difference? The export/import tool is there to move sites around, isn't it? I mean, it's not just being used to copy a site from a specified location on one server to exactly the same location on another server. You can also use it to move a site around within the same site collection or web application.

    Thursday, March 24, 2011 4:45 AM
  • The cmdlet works for me except that in one scenario - I exported a source site which was originally created in SP 2003 and recently upgraded from MOSS 2007 to SP 2010. When I tried to import that site into another 2010 farm, it kept giving me the same error - "Cannot find an SPWeb object with Id or URL: " 

    I finally got the import to work by - 1. creating a destination site with Blank site template and, 2. Running the import-SPWeb cmdlet again. 

     


    Mayank Malik
    Thursday, March 24, 2011 11:59 AM
  • Thanks for doing the research Mayank. I just figured out what the problem was in my case: I didn't have enough access permissions to the SQL Server database. I tried to do the import via stsadm and the error that came up there was a bit more useful than just a "Cannot find an SPWeb object":

    Cannot open database "XYZ" requested by the login. The login failed.

    Now at least I could contact the Service Provider and get them to elevate my permissions. This solved the problem immediate and I can now import the file via PowerShell.

    Andreas.

    • Marked as answer by andreasbbbbb Friday, March 25, 2011 3:58 AM
    Friday, March 25, 2011 3:57 AM