Microsoft Developer Network >
Domovská stránka fór
>
SharePoint - Development and Programming
>
MoveTo() function not working
MoveTo() function not working
Hi,
I have two lists (listA and listB) within same site and same column. I want to move item from listA to listB by using SPFile.MoveTo() function.
without giving any error it is moving from listA but unfortunately it is not showing to target/destination list named listB. I am surprised because of this kind behaviour. If there is no error then where were my moved items?
after developing console application, this SPfile.moveto() function worked for me for 3-4 time but then it will behave like as stated above.
thanks in advance...
--- Arup R(MCTS) Success does not Matter.
Všechny reakce
- Hi All Members,no one has knowledge? it's surprising !!
--- Arup R(MCTS) Success does not Matter. - Hi Arup,
Can you post your complete code.. this will help adressing this issue..
Raghavan - The MoveTo method has three overloads. Can you tell us which one you are calling. If you are setting the argument to overwrite then no error will occur and you maybe overwriting an existing document and you do not know it. How are you verifying that the document did not get moved?
certdev.com - Hi Steve,I have used simple MoveTo() method. Again explaining I have two lista. LISTAb. LISTBLISTA has 5 items and LISTB has no item right now. both list has same columns and schema.after exceuting it's deteting item from LISTA but it's not adding to LISTB and no erros come. Item is surprisingly disappear. mention one ineterseting thing is MoveTo() is working to move item into different folder within same list.any one there to solve this magic...Note: code is not throwing any exception and item also not moving successfully.
--- Arup R(MCTS) Success does not Matter. - ... Copy paste your code instead of repeating the same thing twice...
http://www.areaprog.com - please see the code sample above...
SPList spList = spWeb.Lists["ListA"]; SPList targetList = spWeb.Lists["ListB"]; SPListItem item = spList.GetItemById(1); SPFile item_file = spWeb.GetFile(item.Url); item_file.MoveTo(DestinationURL + "/" + item_file.Name, SPMoveOperations.Overwrite); targetList.Update(); spList.Update(); <br/>
--- Arup R(MCTS) Success does not Matter. - anyone ....
I have pasted my code sample...
...
THanks! Arup R(MCTS) SucCeSS DoEs NOT MatTer. - Hi Arup,
It is not good idea MoveTo methode to send file from one library another library in sharepoint.
Better to use SPImportSettings and SPExportSettings to move files between librarys....
MoveTo methode is having lot of problems. I also faced the same problems. So, I got the solution for my problem with the abou mentioned Objects..
Njoy sharepoint coding....
Regards,
Srikanth
Kancharla....

