可以试着将SPList.Items转化成Json格式。
public static string GetJsonFormSplistItem(SPListItem item, string[] strArr)
{
string json = "{";
for (int i = 0; i < item.ParentList.Fields.Count - 1; i++)
{
string fieldName = item.ParentList.Fields[i].InternalName;
ArrayList ar = new ArrayList();//实例化一个ArrayList
ar.AddRange(strArr);//把数组赋到Arraylist对象
if (ar.Contains(fieldName))
{
if (item[i] != null)
{
json += "\"" + fieldName + "\":\"" + item[i].ToString() + "\",";
}
else
{
json += "\"" + fieldName + "\":\"\",";
}
}
}
json += "},";
return json;
}
public string[] problemRiskArr = { "ProjectName", "ProblemBody", "AffectDegree", "User", "CountermoveBody", "Status" };
SPListItem拼接成Json格式,古老的榕树,5-wow.com