Technical tips, suggestions and learnings on SharePoint.
Home » What We're Thinking » Rez's Spot
ehucsd969j
I am deleting a folder from a document library using the code:
using (SPSite tempDocLibSite = new SPSite(tempDocLibWebRootUrl)) { using (SPWeb tempDocLibWeb = tempDocLibSite.OpenWeb()) { tempDocLibWeb.AllowUnsafeUpdates = true; SPFolder tempAttachmentSubFolder = tempDocLibWeb.GetFolder(string.Format("{0}/{1}/{2}", tempDocLibName, base.ListId.ToString(), hdnTempAttachmentID.Value)); tempAttachmentSubFolder.Delete(); tempDocLibWeb.Update(); tempDocLibWeb.AllowUnsafeUpdates = false; } }
When it get’s to the highlighted line, I get the following error in the event viewer with Event ID: 6875:
Error loading and running event receiver Microsoft.SharePoint.Publishing.Internal.PublishingWebEventReceiver in Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Additional information is below.
: There is no file with URL 'TempAttachmentsUpload/e4486bd9-1719-4a9d-a8a1-de25924cd49a/0136561e-0d20-4b0d-b7e7-ab1e1ada6218' in this Web.
The funny thing is that the folder does exist and does get deleted.
There are lots of resources on the web about this event id for SharePoint but it looks like it’s an event that is very common for different reasons.
I am using MOSS SP1 with the December Cumulative Updates.
It looks like there is a built-in event receiver that is executing when the folder gets deleted which is causing this error. I don’t think it should cause this error and it looks like it’s a bug, hopefully someone can confirm it or correct my code. I’m not sure if it is fixed in SP2 or the April Cumulative Updates though.
[1] Technorati Profile