// Single line of text field value getting
string singleLineOfTextValue = Convert.ToString(listItem["SinLineofText"]);
Console.WriteLine(singleLineOfTextValue);
// Multiple line of text field value getting
string multipleLinesOfTextValue = Convert.ToString(listItem["MulLineofText"]);
Console.WriteLine(multipleLinesOfTextValue);
// Choice field with Drop-Down Menu option
string choiceFieldWithDDM = Convert.ToString(listItem["ChoiceFieldDDM"]);
Console.WriteLine(choiceFieldWithDDM);
// choice field with Radio Buttons option
string choiceFieldWithRB = Convert.ToString(listItem["ChoiceFieldRB"]);
Console.WriteLine(choiceFieldWithRB);
// choice field with Checkboxes (allow multiple selections) option
string choiceFieldWithCB = Convert.ToString(listItem["ChoiceFieldCB"]);
SPFieldMultiChoiceValue multipleValues = new SPFieldMultiChoiceValue(choiceFieldWithCB);
for (int i = 0; i < multipleValues.Count; i++)
{
Console.WriteLine(multipleValues[i]);
}
// Number field value
string numberFieldValue = Convert.ToString(listItem["NumberField"]);
Console.WriteLine(numberFieldValue);
// Currenency field value
string currencyFieldValue = Convert.ToString(listItem["CurrencyField"]);
Console.WriteLine(currencyFieldValue);
// Datetime field value
string dateTimeFieldValue = Convert.ToString(listItem["DateandTimeField"]);
Console.WriteLine(dateTimeFieldValue);
// lookup with allow multiple values option
SPFieldLookupValueCollection valueCollection = (SPFieldLookupValueCollection)listItem["LookupWithAllowMulpVal"];
foreach (SPFieldLookupValue value in valueCollection)
{
Console.WriteLine(value.LookupValue);
}
// lookup without multiple values option
SPFieldLookupValue valueOnly = new SPFieldLookupValue(Convert.ToString(listItem["LookupWithoutMulValues"]));
Console.WriteLine(valueOnly.LookupValue);
// yes no field value
string yesNoFieldValue = Convert.ToString(listItem["YesNoField"]);
Console.WriteLine(yesNoFieldValue);
// Person or group without Multiple selecton
SPFieldUserValue user = new SPFieldUserValue(webObj, Convert.ToString(listItem["PGroupWithoutMultipleSel"]));
Console.WriteLine(user.User.Name +", " +user.User.LoginName);
// Person or group with Multiple selecton
SPFieldUserValueCollection users = new SPFieldUserValueCollection(webObj, Convert.ToString(listItem["PGroupWithMultipleSel"]));
foreach (SPFieldUserValue user1 in users)
{
Console.WriteLine(user1.User.Name + ", " + user1.User.LoginName);
}
// Hyperlink field value
SPFieldUrlValue urlValue = new SPFieldUrlValue(Convert.ToString(listItem["HyporPictureHyp"]));
Console.WriteLine(urlValue.Url);
Console.WriteLine(urlValue.Description);
// Hyperlink field value
SPFieldUrlValue urlValue2 = new SPFieldUrlValue(Convert.ToString(listItem["HyporPicturePic"]));
Console.WriteLine(urlValue2.Url);
Console.WriteLine(urlValue2.Description);
good url:
http://sharepointkings.blogspot.sg/2009/04/spfielduservalue-and.html
string singleLineOfTextValue = Convert.ToString(listItem["SinLineofText"]);
Console.WriteLine(singleLineOfTextValue);
// Multiple line of text field value getting
string multipleLinesOfTextValue = Convert.ToString(listItem["MulLineofText"]);
Console.WriteLine(multipleLinesOfTextValue);
// Choice field with Drop-Down Menu option
string choiceFieldWithDDM = Convert.ToString(listItem["ChoiceFieldDDM"]);
Console.WriteLine(choiceFieldWithDDM);
// choice field with Radio Buttons option
string choiceFieldWithRB = Convert.ToString(listItem["ChoiceFieldRB"]);
Console.WriteLine(choiceFieldWithRB);
// choice field with Checkboxes (allow multiple selections) option
string choiceFieldWithCB = Convert.ToString(listItem["ChoiceFieldCB"]);
SPFieldMultiChoiceValue multipleValues = new SPFieldMultiChoiceValue(choiceFieldWithCB);
for (int i = 0; i < multipleValues.Count; i++)
{
Console.WriteLine(multipleValues[i]);
}
// Number field value
string numberFieldValue = Convert.ToString(listItem["NumberField"]);
Console.WriteLine(numberFieldValue);
// Currenency field value
string currencyFieldValue = Convert.ToString(listItem["CurrencyField"]);
Console.WriteLine(currencyFieldValue);
// Datetime field value
string dateTimeFieldValue = Convert.ToString(listItem["DateandTimeField"]);
Console.WriteLine(dateTimeFieldValue);
// lookup with allow multiple values option
SPFieldLookupValueCollection valueCollection = (SPFieldLookupValueCollection)listItem["LookupWithAllowMulpVal"];
foreach (SPFieldLookupValue value in valueCollection)
{
Console.WriteLine(value.LookupValue);
}
// lookup without multiple values option
SPFieldLookupValue valueOnly = new SPFieldLookupValue(Convert.ToString(listItem["LookupWithoutMulValues"]));
Console.WriteLine(valueOnly.LookupValue);
// yes no field value
string yesNoFieldValue = Convert.ToString(listItem["YesNoField"]);
Console.WriteLine(yesNoFieldValue);
// Person or group without Multiple selecton
SPFieldUserValue user = new SPFieldUserValue(webObj, Convert.ToString(listItem["PGroupWithoutMultipleSel"]));
Console.WriteLine(user.User.Name +", " +user.User.LoginName);
// Person or group with Multiple selecton
SPFieldUserValueCollection users = new SPFieldUserValueCollection(webObj, Convert.ToString(listItem["PGroupWithMultipleSel"]));
foreach (SPFieldUserValue user1 in users)
{
Console.WriteLine(user1.User.Name + ", " + user1.User.LoginName);
}
// Hyperlink field value
SPFieldUrlValue urlValue = new SPFieldUrlValue(Convert.ToString(listItem["HyporPictureHyp"]));
Console.WriteLine(urlValue.Url);
Console.WriteLine(urlValue.Description);
// Hyperlink field value
SPFieldUrlValue urlValue2 = new SPFieldUrlValue(Convert.ToString(listItem["HyporPicturePic"]));
Console.WriteLine(urlValue2.Url);
Console.WriteLine(urlValue2.Description);
good url:
http://sharepointkings.blogspot.sg/2009/04/spfielduservalue-and.html
No comments:
Post a Comment