6

How to get specific properties of object with C# Client SharePoint object model?

My code with JSOM is:

Collection of objects:

clientContext.load(items, "Include(ID, Title, EmpDays, EmpPosition, EmpDirection, EmpDepartment)");

One object:

clientContext.load(user, "Title", "LoginName");

How to do this with C# Client SharePoint Object Model ?

Thank you previously!

1 Answer 1

11

Use a lambda expression like below,

For one item

clientContext.Load(user, u => u.Title, u => u.LoginName);

For a collection

ctx.Load(items, i => i.Include(f => f.Id, f => f.Title));

See here https://www.itunity.com/article/loading-specific-values-lambda-expressions-sharepoint-csom-api-windows-powershell-1249

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.