Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Error during ItemAdded event receiver when files are added via mapped drive (windows explorere/WEBDAV)

$
0
0

errors in ItemAdded eventreceiver when adding files to library via windows explorer (mapped drive)
The error does NOT occur when uploading file via the SharePoint GUI (upload/upload multiple files)

Error details:
Microsoft.SharePoint.SPException: The file "path/file.pdf" is locked for exclusive use by domain\me. --->

System.Runtime.InteropServices.COMException (0x80071779): <nativehr>0x80071779</nativehr><nativestack></nativestack>The file "path/file.pdf"

is locked for exclusive use by domain/me at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(...

Code:

public override void ItemAdded(SPItemEventProperties properties)
        {
             base.ItemAdded(properties);
             SPListItem item = properties.ListItem;
             currentWeb = properties.Web;
             //check out
             item.File.CheckOut();  
             item["columnName"] = "somevalue";
             item.Update();
             // check in
             item.File.CheckIn("comments i want"); // this is where the error occurs.
        }

 I've tried using item.SystemUpdate(false), that did not work
I've tried to make the ItemAdded Synchronous such as this post. but, but when file is added via windows explorer, it uses name of user logged in and has user conflict.

Does anybody have any advice,, ive been rattling my brain for hours.
I would love to be able to skip the itemUpdating event handler in case it is ItemAdded and ItemUpdating conflict.

thanks


Herschel


Viewing all articles
Browse latest Browse all 11571

Trending Articles