I have a document library with a custom column. I want to add a file programatically, as well as a value for the custom column(lookup column).
SPFile file = sourceListItem.ParentList.ParentWeb.GetFile(sourceListItem.Attachments.UrlPrefix + fileName);
byte[] imageData = file.OpenBinary();
SPFile newFile = files.Add(destinatioList.RootFolder.Url + "/" + file.Name, imageData, true);
Hashtable targetItem = newFile.Item.Properties;
//SPListItem targetItem = destinatioList.AddItem();
targetItem["Venue Name"] = sourceListItem["Venu Name"].ToString();
newFile.Update();
It does add the file to the document library, but it does not add the value for the custom column. What am I doing wrong?
Venue_x0020_Nameinstead ofVenue NameandVenu_x0020_Nameinstead ofVenu Name