문제

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top