Save Conflict Error

Asked By Jibin Johnson
30-Jan-10 06:52 AM
Earn up to 0 extra points for answering this tough question.
Hi,

I have a windows forms application which has to upload documents from the file system to a Sharepoint site.Also i have a requirement that i have to run around 5-10 instances of this Win App on the same server instance.
When a case occurs like all the instances of the WinApp upload documents to the same document library,i get the following error.

Save Conflict

Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.   at Microsoft.SharePoint.Library.SPRequestInternalClass.SetListProps(String bstrUrl, String bstrListName, Boolean bMigrate)


Please find below some parts of the code implemented for uploading of documents.

//check version of document.

if(MajorVersion)
{
         splist.enableminorversions=false;
        splist.update();
        if(fileexists)
       {
              //spfile.checkout;
             splist.rootfolder.files.Add();
             //spfile.checkin as major version;
        }
       else
       {
             splist.rootfolder.files.Add();
        }
        spfile.item.updateoverwriteversion();
}
else
{
        splist.enableminorversions=true;
        splist.update();
        if(fileexists)
       {
            //spfile.checkout;
            splist.rootfolder.files.Add();
           //spfile.checkin as minor version;
        }
       else
       {
               splist.rootfolder.files.Add();
       }
       spfile.item.updateoverwriteversion();
}
splist.update();


Beacuse i have to run multiple instances of the WinApp,i am not able to debug which update is creating the problem exactly.please help me find a solution to this.

  re: Save Conflict Error

Sakshi a replied to Jibin Johnson
31-Jan-10 02:18 AM

If you retrieve an SPWeb object from the current context (SPContext.Current.Web), you cannot and should not dispose of this.

A good solution is here.


Thanks and Regards,
www.CodeCollege.NET
www.InterviewsGuru.info

  re: re: Save Conflict Error

Jibin Johnson replied to Sakshi a
01-Feb-10 01:13 AM

Hi,

Thanks for replying..!!

Actually i am not retrieving the spweb object from the current context.My implementation is in lines with the link you sent.

 using (SPSite spSite = new SPSite("URL"))
{
                using (SPWeb spWeb = spSite.OpenWeb())
                {    }

}

I also ran a SPDisposeCheck,the results were positive indicating the object are being disposed properly.

Is this problem somewhere related to the update events...any deadlock or something?If so any solution for this ..?

Create New Account