locked
Value does not fall within the expected range while moving a document between document librarys RRS feed

  • Question

  • Hi Friends,


    I am getting value does not fall within the expected range error when i am running the code something like this

    ListItem.File.MoveTo(DestURL.True)

    Can any one help me why i am getting this error what exactly the solution for this


    Thanks & Regards,
    Kancharla.
    Kancharla....
    Tuesday, May 12, 2009 2:40 PM

Answers

  • sorry for the confusion. It was dot sign in your post. so i just mentioned to make sure it is not a mistake in code.

    Are you providing relative URL? It has to be full URL or relative. but only one option works. You can check which one it is. Secondly you can move the file from one document library to another on the same site to make sure your code works fine. Then provide the URL to a subsite to move it to a subsite. I had some issues playing with MoveTo. especially it does not move history of a document. so i had to write my own method to move a document with version history.
    Moonis Tahir MCSD.net, MCTS Sharepoint 07 (Dev & Config), MCTS BizTalk 06, MCTS SQL 2005.
    Tuesday, May 12, 2009 4:18 PM

All replies

  • .MOVETO method requires a URL while from your code it looks like your DesUrl.True is a boolean value. to test it, please check the URL 1st and pass it on to MoveTo Method.
    Moonis Tahir MCSD.net, MCTS Sharepoint 07 (Dev & Config), MCTS BizTalk 06, MCTS SQL 2005.
    Tuesday, May 12, 2009 2:55 PM
  • Hi Tahir,


    That is not the dot between DestURL and true. It is a comma....  Here DestURL is a string which contains a URL for the destination document library.


    Thanks & Regards,
    Srikanth.K

    Kancharla....
    Tuesday, May 12, 2009 3:58 PM
  • sorry for the confusion. It was dot sign in your post. so i just mentioned to make sure it is not a mistake in code.

    Are you providing relative URL? It has to be full URL or relative. but only one option works. You can check which one it is. Secondly you can move the file from one document library to another on the same site to make sure your code works fine. Then provide the URL to a subsite to move it to a subsite. I had some issues playing with MoveTo. especially it does not move history of a document. so i had to write my own method to move a document with version history.
    Moonis Tahir MCSD.net, MCTS Sharepoint 07 (Dev & Config), MCTS BizTalk 06, MCTS SQL 2005.
    Tuesday, May 12, 2009 4:18 PM