Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Problem With Event Sink

  Asked By: Brent    Date: Apr 28    Category: Sharepoint    Views: 759

In one of our projects, we are trying to register an Event Sink for a
Document Library. In the event sink we need to update few Taxonomy
Fields of the uploaded file. We are able to succeed in this regard. But
when we fire a search with the Metadata we fail to view the file in the
restltset.

However by removing the update taxonomy fields functionality (shown bold
in the code snippet - this uploads Metadata to the File) in the Event
sink or removing the Event Sink from the document library we are able to
successfully search for the document.

How to overcome this problem? The code snippet of the EventSink is given
below:

Code Snippet:
-----------------
public void OnEvent(Microsoft.SharePoint.SPListEvent evt)
{
if(evt.Type == SPListEventType.Insert)
{
SPWeb mySite = evt.Site.OpenWeb();
file = mySite.GetFile(evt.UrlAfter);
try
{

file.Item["Last Modified By"] = evt.UserLoginName;
file.Item.Update();
}
catch(Exception e)
{
LogInfo("My Update " + e.Message);
}
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Problem With Event Sink Or get search suggestion and latest updates.




Tagged: