假设我有以下代码行:
context.Load(itemCollection, item => item.Include(i => i["Title"], i => i["Name"]));
有什么方法可以动态指定item.Include()
函数的参数,而不是像上面那样对它们进行硬编码?
理想情况下,我希望允许用户选择他们想要检索对象的属性,例如Title
, Name
,Description
等。
仅供参考,这是ClientContext.Load
功能。该功能来自Microsoft.SharePoint.Client.dll
public void Load<T>(T clientObject, params Expression<Func<T, object>>[] retrievals) where T : ClientObject
{
if ((object) clientObject == null)
throw new ArgumentNullException("clientObject");
ClientAction.CheckActionParameterInContext(this, (object) clientObject);
DataRetrieval.Load<T>(clientObject, retrievals);
}