List Item disappears from views
-
We've been encountering a problem with our lists. A big chunk of list items disappear in the Data Views. But if we go and check out View All Items and view the items of that List. They're not there too. If you enable the filter of that View, you can see the key of that missing list item. We tried running a script to update all items for that list and the list items return and can be seen again. We don't know what's wrong. Now this begins to happen as well to another list. Now, both of these lists have attachments uploaded as part of its functionality. And sometimes the list items disappear after doing something with the attachment (still dunno yet if it's upon upload/deleting the attached file). But the funny thing is, it's not only that item which is affected. When this error occurs, it affects a big chunk of the records like 90% (not fixed, no pattern) of the items disappear and would only be restored when we update all items in the list via script. The upload script just uses the code of Sharepoint. As for the other list, in View All Items, looking at the contents of the list, they're there. We just update the list from there and the items appears back in the views. We dunno how we can catch this error. What happened? Has anyone encountered this? Would really appreciate your response to this.
-
We've been encountering a problem with our lists. A big chunk of list items disappear in the Data Views. But if we go and check out View All Items and view the items of that List. They're not there too. If you enable the filter of that View, you can see the key of that missing list item. We tried running a script to update all items for that list and the list items return and can be seen again. We don't know what's wrong. Now this begins to happen as well to another list. Now, both of these lists have attachments uploaded as part of its functionality. And sometimes the list items disappear after doing something with the attachment (still dunno yet if it's upon upload/deleting the attached file). But the funny thing is, it's not only that item which is affected. When this error occurs, it affects a big chunk of the records like 90% (not fixed, no pattern) of the items disappear and would only be restored when we update all items in the list via script. The upload script just uses the code of Sharepoint. As for the other list, in View All Items, looking at the contents of the list, they're there. We just update the list from there and the items appears back in the views. We dunno how we can catch this error. What happened? Has anyone encountered this? Would really appreciate your response to this.
Below is code snippet in c#.net for fetching all the attachements for a specific list item. try { // 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; // Iterate the attachments foreach (string fileName in objItem.Attachments) { // Perform action on the extracted attachment } http://www.mindfiresolutions.com/Adding-an-Attachment-to-a-List-Item-Programmatically-in-SharePoint-478.php[^]
Cheers, Eliza