I have timer job which creates new list item in custom list and then add attachment to the list item. It works perfectly fine but it threw one error once and there is no exception message in logging and only stack trace which leaves me guessing issue, typical microsoft stack traces :(.

Below is the stack trace, please help me to get the reason.

System.Runtime.InteropServices.COMException: <nativehr>0x80131904</nativehr><nativestack></nativestack>, StackTrace:   
 at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)    
 at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)    
 at Microsoft.SharePoint.SPListItem.Update()    
 at OTIS.AR.DataFileTimerJob.DataFileTimerJob.InsertInSPList(ARType Type, SPList splist, DataRow dr, SPWeb spWeb)    
 at OTIS.AR.DataFileTimerJob.DataFileTimerJob.Execute(Guid targetInstanceId)    
 at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result)    
 at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result)

Edit 1: Even after getting this error list item got added into list but attachment did not.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.