TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mohammad qasim
NA
408
0
Select all columns but group by only one in linq,How to Get only Id fr
Sep 14 2020 1:59 PM
Greetings
I am using Sharepoint 2016 on Prem
I want to Select all columns but apply "group by" only one using LINQ ( retrieve data from Sharepoint list )
Problem : Currently having 2 problems/challenges
Problem 1: I have lookup field which returns id with name like "23;#abcd" , for this I have to split to get Id only ( mention in below code using split(';').
Problem 2: in LINQ query ,I want to select stautus and documentname columns from list not on "group by".
Group by is just for 1 column like we do in sql server like below as
stautus and documentname feilds are not available in group by so unable to select these 2 fields
select
id,stautus ,documentname,comments
from
abc groupby userFk
My Code:
oQuery.Query =
"<Where><Eq><FieldRef Name='Flag'/><Value Type ='number'>"
+ 1 +
"</Value></Eq></Where> "
;
var resultfoldeDoc11 = (from SPListItem itm
in
pLis.GetItems(oQuery)
orderby itm[
"ID"
]
group itm by
new
{ m_folderID22 = itm[
"DocumentFolderFk"
] } into g
select
new
{ m_folderId22 = g.Key.m_folderID22.ToString().Split(
';'
), m_totaldocsfoldercount = g.Count() });
Solution Required:for Both Problem
How can I select multiple columns in select clause with one field in "Groupby " Clause ?
How can I get only ID from Look up field in LINQ
Thanks
Reply
Answers (
1
)
Error while publishing the workflow 2013
Please explain below Property Use of Below Property in SharePoint