How to get the metadata of a file in SharePoint
-
11-06-2021 - |
Domanda
I am trying to get the name property of a file on SharePoint ?
If I try to get the metadata of the columns I created, I can get this data with this method
file is SPFile.
if (file.GetProperty("DocId") != null)
{
docId = file.GetProperty("DocId").ToString();
}
But when I try to get the name
if (file.GetProperty("Name") != null)
{
docId = file.GetProperty("Name").ToString();
}
else {...}
it goes to else statement.
Where do I go wrong?
Thanks.
Soluzione 2
It's OK after I use
file.Item.Name;
Altri suggerimenti
Most likely you want to look at properties of an SPItem associated with the SPFile in a document library - SPFile.GetListItem.
You can also enumerate all properties of the file with SPFile.Properties to see that name of "file name" property is something like "vti_title".
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow