C# 如何在SharePoint中获取文件的元数据

C# 如何在SharePoint中获取文件的元数据,c#,sharepoint,metadata,spfile,C#,Sharepoint,Metadata,Spfile,我正在尝试获取SharePoint上文件的name属性 如果我尝试获取我创建的列的元数据,我可以使用此方法获取此数据 文件是SPFile if (file.GetProperty("DocId") != null) { docId = file.GetProperty("DocId").ToString(); } 但是当我想知道名字的时候 if (file.GetProperty("Name") != null) { docId = file.GetProperty("Name

我正在尝试获取SharePoint上文件的name属性

如果我尝试获取我创建的列的元数据,我可以使用此方法获取此数据

文件是SPFile

if (file.GetProperty("DocId") != null)
{
    docId = file.GetProperty("DocId").ToString();
}
但是当我想知道名字的时候

if (file.GetProperty("Name") != null)
{
    docId = file.GetProperty("Name").ToString();
}
else {...}
它转到else语句

我哪里出错了


谢谢。

您很可能希望查看与文档库中的SPFile关联的SPItem的属性-

您还可以使用枚举文件的所有属性,以查看“file name”属性的名称类似于“vti_title”。

使用后就可以了

file.Item.Name;

使用file.Item.Name后就可以了;谢谢你提供的信息。