System.Net.WebException: The remote server returned an error: (409) Conflict.

Hello,

We're trying to upload a lot of data (350+GB) to our on premises instance of SharePoint 2013.

This data is currently on a shared drive and consists of 1M+ documents on probably 10000+ different folders.

I've written a simple multithreaded tool that uploads the files to SP.

The his uses Parallel.ForEach. and works ok with small amounts of data, but when we try it in anger we tart getting this exception

Net.WebException: The remote server returned an error: (409) Conflict.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
   at Microsoft.SharePoint.Client.File.SaveBinary(ClientContext context, String serverRelativeUrl, Stream stream, String etag, Boolean overwriteIfExists, SaveBinaryCheckMode checkMode)
   at Migrator.Program.UploadFile(ClientContext context, String filePath, Boolean exception) in c

Interestingly, if I ramp up the number of threads, I get a lot more of these exceptions.

Perhaps, more interestingly we seem to get the error always for the same files, at least after two tries.

I can't really see anything on the SP log, at least anything I can make sense out of.

The below seems to happen after the issue occurrs but not sure if this is the case or just an unrelated exception.

Set EventFiringDisabled to [False].  Stack trace: [   at Microsoft.Office.Server.Utilities.EventReceiverUtility.DisabledEventFiringScope.Dispose()     
at Microsoft.Office.Server.Utilities.EventReceiverUtility.RunItemEventReceiverExProps(Boolean handleVersionConflicts, MonitoredScopeWrapper monitoredScopeWrapper, Boolean disableEventFiring, SPItemEventProperties properties, ItemEventReceiverCodeToRunProps codeToRun)     at Microsoft.Office.Server.Utilities.EventReceiverUtility.RunAndHandleVersionConflictsExProps(MonitoredScopeWrapper monitoredScopeWrapper, Boolean disableEventFiring, SPItemEventProperties properties, ItemEventReceiverCodeToRunProps codeToRun)     at Microsoft.Office.DocumentManagement.DocumentId.ItemChangedInternal(SPItemEventProperties properties, Boolean fOverwrite)     a... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
...t Microsoft.Office.DocumentManagement.Internal.DocIdHandler.ItemChangedInternal(SPItemEventProperties properties, Boolean fOverwrite)     at Microsoft.Office.DocumentManagement.Internal.DocIdHandler.ItemAdded(SPItemEventProperties properties)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver receiver, SPUserCodeInfo userCodeInfo, SPItemEventProperties properties, SPEventContext context, String receiverData)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, SPUserCodeInfo userCodeInfo, Object properties, SPEventContext context, String receiverData)     at Microsoft.SharePoint.SPEventManager.<>c__DisplayClassa`1.<InvokeEventReceiver>b__7()     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bRe... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
...setContext, WaitCallback code, Object param)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceiver[ReceiverType](SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Int32 n, Object properties, SPEventReceiverOperationsType operationsType, Boolean& canceled, String& error)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPRemoteEventReceiverCallType remoteCallType, SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, RunRemoteEventReceiver runRemoteEventReceiver, Object receivers, Object properties, Boolean checkCancel, SPEventReceiverOperationsType operationsType)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPRemoteEventReceiverCallType remoteCallType,... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
... Byte[] userTokenBytes, Guid tranLockerId, RunEventReceiver runEventReceiver, RunRemoteEventReceiver runRemoteEventReceiver, Object receivers, Object properties, Boolean checkCancel, SPEventReceiverOperationsType operationsType)     at Microsoft.SharePoint.SPEventManager.ExecuteItemEventReceivers(Byte[]& userToken, Guid& tranLockerId, Object& receivers, ItemEventReceiverParams& itemEventParams, Object& changedFields, EventReceiverResult& eventResult, String& errorMessage)     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrDeleteUrl(String bstrUrl, String bstrDirName, Boolean bAdd, UInt32 dwDeleteOp, Int32 iUserId, Guid& pgDeleteTransactionId)     at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrDeleteUrl(String bstrUrl, String bstrDirName, Boolean bAdd, UInt32 dwDel... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
...eteOp, Int32 iUserId, Guid& pgDeleteTransactionId)     at Microsoft.SharePoint.Library.SPRequest.AddOrDeleteUrl(String bstrUrl, String bstrDirName, Boolean bAdd, UInt32 dwDeleteOp, Int32 iUserId, Guid& pgDeleteTransactionId)     at Microsoft.SharePoint.SPFolderCollection.AddInternal(String strUrl, Int32 userId)     at LD_FolderStructure.Events.Events.CreateFolderStructure(SPItemEventProperties properties)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver receiver, SPUserCodeInfo userCodeInfo, SPItemEventProperties properties, SPEventContext context, String receiverData)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, SPUserCodeInfo userCodeInfo, Object properties, SPEventContext context, String receiverData)     at Mi... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
...crosoft.SharePoint.SPEventManager.<>c__DisplayClassa`1.<InvokeEventReceiver>b__7()     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceiver[ReceiverType](SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Int32 n, Object properties, SPEventReceiverOperationsType operationsType, Boolean& canceled, String& error)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPRemoteEventReceiverCallType remoteCallType, SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, RunRemoteEventReceiver runRemoteEventReceiver, Object receivers, Object properties, Boolean checkCancel, SPE... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
...ventReceiverOperationsType operationsType)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPRemoteEventReceiverCallType remoteCallType, Byte[] userTokenBytes, Guid tranLockerId, RunEventReceiver runEventReceiver, RunRemoteEventReceiver runRemoteEventReceiver, Object receivers, Object properties, Boolean checkCancel, SPEventReceiverOperationsType operationsType)     at Microsoft.SharePoint.SPEventManager.HandleEventCallback[ReceiverType,PropertiesType](Object callbackData)     at Microsoft.SharePoint.Utilities.SPThreadPool.WaitCallbackWrapper(Object state)     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)     at System.Threading.ExecutionContext.Run(Execution... 7f311d9d-2565-e02b-95fa-1ca09f0d4749
...Context executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)     at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()     at System.Threading.ThreadPoolWorkQueue.Dispatch()  ] 7f311d9d-2565-e02b-95fa-1ca09f0d4749

Any ideas?

Thanks

July 25th, 2015 12:40pm

Hi Agoney,

From the error message, it seems that you are using client object model to upload the files to SharePoint library.

How did you upload the file to SharePoint?

Please check the links below to see if the code in the links below works for you:

http://blogs.msdn.com/b/sridhara/archive/2010/03/12/uploading-files-using-client-object-model-in-sharepoint-2010.aspx

http://sharepoint.stackexchange.com/questions/84707/upload-to-document-library-subfolder-in-client-object-model

Here are some similar threads for your reference:

https://social.msdn.microsoft.com/Forums/en-US/fbb38b10-1127-48a6-a65f-0301edd766c4/the-remote-server-returned-an-error-409-conflict-error-while-uploading-files-to-sharepoint?forum=sharepointdevelopmentlegacy

http://stackoverflow.com/questions/4369169/sharepoint-2010-client-object-model-upload-document-409-conflict

Thanks,

Victoria

Free Windows Admin Tool Kit Click here and download it now
July 26th, 2015 2:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics