标签:os for div re new c
可以试着将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格式,布布扣,bubuko.com
SPListItem拼接成Json格式
标签:os for div re new c
原文地址:http://www.cnblogs.com/yixiaozi/p/3842715.html