System.PlatformNotSupportedExcepti on exception
I am getting System.PlatformNotSupportedException exception on running this code. can anyone tell me what is the problem in this code.
public
IList<ProductLine> GetProductLines()
{
//TODO Get Product Lines from SharePoint
List<ProductLine> productlines =
new List<ProductLine>();
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite configsite =
new SPSite("http://<site>/"))
{
using (SPWeb web = configsite.OpenWeb())
{
SPList list = web.GetList("Products");
SPQuery query = new
SPQuery();
query.Query =
"<OrderBy><FieldRef Name='Product Line'/>"
+
"</Order By><FieldRef Name='Product Line' />";
SPListItemCollection items = list.GetItems(query);
if (items.Count > 0)
{
foreach (SPListItem item
in items)
{
productlines.Add(new
ProductLine() { Name = item.Name, Id= item.ID });
}
}
}
}
});
return productlines;
}
November 18th, 2010 7:43am