Move ListItem within function ItemAdded

Oct 5, 2009 at 3:54 PM

Hi Christian,

i try to move a listitem to a subfolder after the item is created via Newform.aspx with the PowerEventReciever.

When i try to move the listitem with the following Code, i get an exception

[Microsoft.SharePoint.SPFile] $file = $web.GetFile($item.Url)
$file.MoveTo($destination)

This is the exception:

"Fehler beim Aufrufen der Methode, da [Microsoft.SharePoint.SPFile] keine Methode mit dem Namen "op_Addition" enthält."

The exeption is caused from: [Microsoft.SharePoint.SPFile] $file = $web.GetFile($item.Url)

I tried to move the Listitem with the same code within the PowerWebpart and everything works fine...
Do you have any Idea what causes the exeption?

Michael

Coordinator
Oct 6, 2009 at 9:44 AM

Hi Mich,

seems weird. At the moment haven't any idea? :-(

Bye, Christian

Oct 6, 2009 at 10:03 PM

Hi Christian,

i'm not sure why, but when i use another name then $file everything works fine...

Is $file already assigned by the event reciever?

Bye,

Michael