How to retrieve SharePoint user data using LINQ?
I am trying to retrieve data from list using LINQ, and have SPMETAl ran for the latest list version. All data from the list is successfully retrieved besides created by, created, modified by, modified. The SPMETAl returned a CS file named marketing and below is the code for my LINQ data retrieval in C#
MarketingDataContext newMarket = new MarketingDataContext("http://strikychoong- lt/marketing");
EntityList<QuotationItem> Quotation = newMarket.GetList<QuotationItem>("Quotation");
searchResult = from searching in Quotation
where searching.Title.Equals(TextBox1.Text)
select searching;
The auto-complete for searching. did show every attributes in the lists besides the 4 user data above.
How can I actually retrieve these 4 da开发者_如何学运维ta (created by, created, modified by, modified)?
I am very new to SharePoint and LINQ.
these objects (created by, created etc) cannot be targeted by using Linq. If you want to use them, use them the 'oldfashion' way:
SPList list = ...
var results = from item in list.Items.Cast<SPListItem>()
where item["CreatedBy"].ToString().Equals("username")
select item
msdn info
精彩评论