We upload all our documents in one site and map them to portal areas. When we upload a document and enter taxonomies manually, we can search the document.
But when we upload the document and upload the taxonomies by an Event Sink( program code for uploading document with metadata & approval), this uploads the document but we are not able to search the document.
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.
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);
}
}
}
--------------------------
Do you know someone who can help? Share a link to this thread on twitter, or facebook.