locked
MOSS 2007 Importing a Subsite using SPImport fails. RRS feed

  • Question

  • Hi,

    I tried importing a subsite using SPImport class and it is working fine in Console Appplication. When I tried implementing it as a WCF service/run it from a Web Application it fails . Following error is thrown on exceuting the Run() method of SPImport object. Please find the following error below:

    Microsoft.SharePoint.SPException: Updates are currently disallowed on GET requests.  To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb. ---> System.Runtime.InteropServices.COMException: Updates are currently disallowed on GET requests.  To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.\u000d\u000a   at Microsoft.SharePoint.Library.SPRequestInternalClass.CreateWeb(String bstrUrl, String bstrTitle, String bstrDescription, UInt32 nLCID, String bstrWebTemplate, Boolean bCreateUniqueWeb, Boolean bConvertIfThere, Guid& pgWebId, Guid& pgRootFolderId, Boolean bCreateSystemCatalogs)

    I tried setting AllowUnsafeUpdates to true of SPSite and SPWeb object, and running the code using RunWithElevatedPrivileges, but still in vain.

    Kindly help.

    Regards,

    Priya

    Wednesday, April 18, 2012 5:20 AM

Answers

  • Hello Priya,

    We faced the same problem. The web page which is calling these methods should have a POST request. It will not work with a GET request.

    Another way is to implement all you importing logic (using SPImport) in a console application and get a the exe.Run this exe process through your WCF service or Web Page by passing the parameters to it (if required)

    We followed the second approach and it works fine for us..


    Ram Prasad Meenavalli | MCTS SharePoint 2010 | MCPD SharePoint 2010

    • Marked as answer by Priya_k Wednesday, April 18, 2012 8:27 AM
    Wednesday, April 18, 2012 5:28 AM

All replies

  • Hello Priya,

    We faced the same problem. The web page which is calling these methods should have a POST request. It will not work with a GET request.

    Another way is to implement all you importing logic (using SPImport) in a console application and get a the exe.Run this exe process through your WCF service or Web Page by passing the parameters to it (if required)

    We followed the second approach and it works fine for us..


    Ram Prasad Meenavalli | MCTS SharePoint 2010 | MCPD SharePoint 2010

    • Marked as answer by Priya_k Wednesday, April 18, 2012 8:27 AM
    Wednesday, April 18, 2012 5:28 AM
  • Thanks Ram Prasad.. This solution worked..
    Wednesday, April 18, 2012 8:28 AM