Hello,
I have written a event receiver code in SharePoint 2013 Item updated event to edit metadata properties of the document and copying\moving it to another library.
It is working for a MS word & Excel older versions like(.doc , .xls , .txt , .png etc)
It is not working for a MS word & Excel older versions like(.docx , .xlsx)
my code is as below
using (SPSite site = new SPSite("http://yoursiteurl"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["test"];
SPListItem item = properties.ListItem;
//add metadata
Hashtable ht = new Hashtable();
ht.Add("testcol", "myfile");
ht.Add("vti_title", "mytitle");
SPFile destfile = list.RootFolder.Files.Add(item.File.Name, item2.File.OpenBinary(), ht, true);
destfile.update();
}
}
Many thanks in advance
Thanks
Ravi Patil