Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Programmatically retrieving value of Metadata of specific document in Sharepoint using Server Object Model

$
0
0

Hi

I am trying to get Meta data information of an item (document) exists in document library.

At the time when I update this item, I put some additional information in hash table with this item programmatically. using the below code

                                    SPFolder target = oSpWeb1.GetFolder(doclibraryname);

                     SPFileCollection files = target.Files;

 Hashtable ht = newHashtable();

                     ht.Add("testcol","myfile");

                    target.Files.Add(oItem.File.Name, _docbytes , ht , true);

 

I have two questions,

1. Is that the right way to set Meta information against an item.

2. How to get this Meta Information programatically.

I am trying to get it from below code, but it does not work it returns exception.

               object fieldValue = spfile.Item["testcol"];

Any help will be highly appreciated.

Thanks
Saad



Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>