Live Task How to get User Defined Fields within a Custom List Type using SharePoint 2010 Event Reiever
ArrayList ArrColumnNames = new ArrayList();
ArrayList ArrOldValues = new ArrayList();
SPListItem item = properties.ListItem;
for (int
i = 0; i <= properties.List.Fields.Count - 1; i++)
{
if (!properties.List.Fields[i].Hidden
&& !properties.List.Fields[i].ReadOnlyField &&
properties.List.Fields[i].Type != SPFieldType.Attachments
&& properties.List.Fields[i].Title != "Content
Type")
{
ArrColumnNames.Add(properties.List.Fields[i].StaticName);
if
(item[properties.List.Fields[i].StaticName] != null)
{
string strColumnName =
properties.List.Fields[i].StaticName.ToString();
ArrColumnNames.Add(strColumnName);
if(item[strColumnName]!=null)
{
ArrOldValues.Add(item[strColumnName]).ToString();
}
}
}
}
string strSqlServerFieldName = "";
string
strSqlServerOldFieldValue = "";
for (int
j = 0; j < ArrColumnNames.Count - 1; j++)
{
strSqlServerFieldName+= ArrColumnNames[j].ToString()+"!!";
strSqlServerOldFieldValue+= ArrOldValues[j].ToString()+"!!";
}
No comments:
Post a Comment