2016-05-12 72 views

回答

0

实际上一个项目总是一个项目(SPListItem对象)。
如果您从库中获取某个项目,则必须使用SPItem.File来获取适当的SPFile对象。

为确保您拥有一个文件,您可以使用SPFile(请参阅https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.spfile.exists.aspx)的Exists属性。

... 
var item = GetListItemById(1); 
if (item.File.Exists) 
{ 
    var file = item.File; 
    //handle file 
} 
... 

HTH,
丹尼尔

相关问题