1

I'm writing an event receiver on a document library. My issue is event itemupdating ou itemupdated are not fire when i drag and drop a document. if i log my event it only passes in itemadding and itemadded.

In classic upload it goes to itemadding and itemadded and at the next window when you enter the meta value.

Are there a way to pass in itemupd... when i drag and drop?

If i set a meta in itemadded with

properties.listItem["meta"] = "test";
properties.ListItem.Update();

It works with drag and dropped element but with classic update i have an exception because i update the item before saving meta (second form)

Finally i add allowed content type and column in my event receiver feature activated

SPSite site = properties.Feature.Parent as SPSite;
            using (SPWeb web = site.RootWeb)
            {
                //retrieve docset contenttype
                SPContentType CTDocumentSet = web.ContentTypes["DocumentSetGeolocation"];
                //create the new document set contenttype
                SPContentType CTPicture = web.ContentTypes["PictureGeolocation"];
                //get a an instance of DocumentSetTemplate for the document set geolocation
                DocumentSetTemplate newDocumentSetTemplate = DocumentSetTemplate.GetDocumentSetTemplate(CTDocumentSet);
                //remove allowable content type Document
                newDocumentSetTemplate.AllowedContentTypes.Remove(web.ContentTypes["Document"].Id);
                //add allowable content types
                newDocumentSetTemplate.AllowedContentTypes.Add(CTPicture.Id); 
                //add a shareable property
                Guid guidChantier = new Guid("99afd525-b766-4249-b933-de94c987d218");
                newDocumentSetTemplate.SharedFields.Add(CTDocumentSet.Fields[guidChantier]);
                newDocumentSetTemplate.Update(true);
                CTDocumentSet.Update();
                web.Update();
            }
  • 1
    You'll need to update something for those two events to fire. Dragging and dropping a file only creates a new item in the library. – jpollar Jan 13 '16 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.