답변됨 MOSS 2007 Importing a Subsite using SPImport fails.

  • 2012년 4월 18일 수요일 오전 5:20
     
     

    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

모든 응답

  • 2012년 4월 18일 수요일 오전 5:28
     
     답변됨

    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

    • 답변으로 표시됨 Priya_k 2012년 4월 18일 수요일 오전 8:27
    •  
  • 2012년 4월 18일 수요일 오전 8:28
     
     
    Thanks Ram Prasad.. This solution worked..