Document movement in SharePoint 2003

Discussion in 'ASP .Net Web Controls' started by Todd Jasper via .NET 247, May 4, 2004.

  1. I am running into problems in SharePoint Portal 2003 when my webpart goes to move documents from a document library on onesub-site to a document library on a different sub-site. Bothsub-sites are on the same level, which is one level down off themain portal site. Also, my web part has full trust privelegesto run. The security exception that I receive says:

    The security validation for this page is invalid. Click Back inyour Web browser, refresh the page, and try your operationagain. ---> System.Runtime.InteropServices.COMException(0x8102006D):

    Here is my code:

    Dim File As SPFile = m_Web.GetFile("/sites/FirstSite/DocumentLibrary/Folder/ExcelSpreadsheet.xls")
    Dim Site As New SPSite("https://portal")
    Dim Web As SPWeb = Site.OpenWeb("/sites/SecondSite")
    Dim FilesCollection As SPFileCollection
    FilesCollection = Web.GetFolder("/sites/SecondSite/DocumentLibrary/Folder").Files

    ' SECURITY EXCEPTION OCCURS HERE ON THE ADD
    FilesCollection.Add(File.Url, File.OpenBinary)

    Any thoughts or ideas would be much appreciated, thanks.

    --------------------------------
    From: Todd Jasper

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>xWjAbqN9K024dLGvo7ELyw==</Id>
    Todd Jasper via .NET 247, May 4, 2004
    #1
    1. Advertising

  2. Todd Jasper via .NET 247

    LarsDahl Guest

    Maybe you have to set

    Code:
    --------------------

    FilesCollection.Web.AllowUnsafeUpdates = true

    --------------------

    Just before the Add ...



    --
    LarsDahl
    ------------------------------------------------------------------------
    Posted via http://www.mcse.ms
    ------------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message638953.html
    LarsDahl, Aug 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lee Connell
    Replies:
    1
    Views:
    413
    Ganesan Subramanian
    Apr 28, 2004
  2. laks
    Replies:
    0
    Views:
    424
  3. Robin
    Replies:
    3
    Views:
    2,423
    Moustafa
    Jan 15, 2005
  4. apondu
    Replies:
    1
    Views:
    322
    Alvin Bruney [MVP]
    May 31, 2007
  5. apondu
    Replies:
    1
    Views:
    124
    Alexey Smirnov
    May 30, 2007
Loading...

Share This Page