Can you pass an SPListItem object as a parameter into a custom [WebMethod] deployed into SharePoint? I understand that it would be essentially disconnected from the the SharePoint context if it was, but that suits me fine as I'm just saving some of this SPListItem data elsewhere (no updates).
I tried this for testing purposes but SPDev threw an error generating the .disco & .wsdl;
[WebMethod]
public bool saveData(SPListItem ticket, string action)
{
string msg = "";
try
{
msg += ticket.Xml.ToString();
msg += Environment.NewLine;
}catch(Exception ex){
msg += ex.Message.ToString();
}
finally{
processLog.WriteToLog(msg, LogFile_NM);
}
return true;
}
Something about this approach seems wrong, but I can't quite put my finger on it...
Thanks.
As I suspected, a fundamental flaw - an SPListItem is not serializable!