Do you know how to add docx attachment to list programmatically? I have gone through the below code snippet in c#.net for fetching all the attachements for a specific list item which I think isnt correct, so can you let me know about same:
Code:
{
// Set the Site Url
SPSite objSite = new SPSite("http://Testsite/");
using (SPWeb objWeb = objSite.OpenWeb())
{
objWeb.AllowUnsafeUpdates = true;
// Get the List
SPList objList = objWeb.Lists["MyList"];
// Get the item by ID
SPListItem objItem = objList.GetItemById(1);
// Get the attachments of the item
SPAttachmentCollection objAttchments = objItem.Attachments;
Bookmarks