I am using SPFieldUserValue to fetch the users from sharepoint list which is having person column. But my metadata service is facing some problem and it is showing error in navigation of my sharepoint site as -
"The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator."
Does this have any connection to SPFieldUserValue function of sharepoint? When i use this function i get the error as -
Value does not fall within the expected range
I just came across the problem which was causing the exception of value does not fall within the expected range.
I was trying to get list data and putting it into datatable and on datatable i was trying to fetch the user from sharepoint site. Instead of datatable if i directly get data from sharepoint list, thn there is no exception.
Error Due to
DataTable dtrqacaml = RQA2list.GetItems(oRQA2Query).GetDataTable();
DataView dtview = new DataView(dtrqacaml);
DataTable dtdistinct = dtview.ToTable(true, "RQA_Manager2");
foreach(DataRow dr in dtdistinct.Rows)
{
SPFieldUserValue userValue = new SPFieldUserValue(SPContext.Current.Web, dr["RQA_Manager2"].ToString());
.
.
}
Error Resolution
foreach (SPListItem li in CClist.Items)
{
SPFieldUserValue userValue = new SPFieldUserValue(SPContext.Current.Web, li["CC_Person"].ToString());
.
.
}