I'm current working on a webpart which uses the search engine to get all crawled tasks and return the ones assigned to the currently logged in user.

I'm using the field AssignedTo where I give the search string the SPWeb.CurrentUser.Name as the value parameter, but there are cases where users' Name property are identical (people sometimes have the same name, who would have thought) and the webpart returns results that are not ment for some users.

My search string looks like this so far:

ContentClass:"STS_ListItem_Tasks" AND AssignedTo:"<Current user name>" NOT Status:"Complete"

Is there are more explicit way of searching for tasks assigned to the currently logged in user without using their name but perhaps their ID or SSID or some completely third property that is a unique identifier?

  • I recently worked on a similar requirement. I ended up creating a custom webpart that extends CoreResults WebPart. Also you should make sure to handle the Group scenario where the current user is part of a SharePoint group and there is a task assigned to that group. – Amal Hashim Apr 20 '15 at 14:48
  • @AmalHashim Can you elaborate in an answer what you did and maybe an example? – user2536 Apr 20 '15 at 14:54

Your Answer

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