Get the field ID of the list item after upload a file and update custom metadata #1141
-
Hi, I am uploading a file in a document library as follow: ............ // Load the file metadata again to get the ListItemFields populated // Update file properties file.ListItemAllFields["Field1"] = "example1"; Field1 and Field2 are custom properties for that library and I would like to know what is the best way to check if the custom properties exist in the library. Also how I can query the field ID for the list item where the file was uploaded. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
I noticed the ID is available in file.ListItemAllFields.Id What will be the best way to check if a field is part of the collection fields for that file. Should I be using IsPropertyAvailable? If so, can I have an example? Thanks |
Beta Was this translation helpful? Give feedback.
-
I will explain my requirement: After upload the file, I need to update the metadata, but not all the metadata are available in all the libraries, and I don't know which library I am getting the request to upload the file, so this is what I need to do: 1-Upload the file and I dont want to load all the fields in the library, just the ones that exist I hope I make sense Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
Hi, Thank you very much for your help. I did not explain myself very well. I know the name of the library, so I can get the reference to the library: // Get Document Library List Object then I upload the file, and after the upload is completed, I loop through the ListItemAllFields dictionary and if the field exist then I update the value: // Load the file metadata again to get the ListItemFields populated // Update properties But I need to load all the properties to check if the property is in the dictionary or not. My question is: is there a better way to load just the set of custom properties that exist for that particular library? I get from the client: Thank you so much |
Beta Was this translation helpful? Give feedback.
-
Ok, it makes sense, thanks! |
Beta Was this translation helpful? Give feedback.
Ok, it makes sense, thanks!