I have a custom web part which runs a KeywordQuery to find all tasks across all site collections assigned to the current user.

The query itself looks like this:

"ContentClass:'STS_ListItem_Tasks' AND AssignedTo:'" + web.CurrentUser.Name + "' NOT Status:'Complete'"

The property web.CurrentUser.Name gives me the displayname, however some site collections uses Claims and the displayname contains something like i:05.t|asdf saml v3|UserInitials@domain.com which the search engine doesn't recognize and then it returns 0 results.

Is there some other keywords or unique properties I can use instead of AssignedTo which will guarantee that tasks for current user will always be found regardless of name - like Sid, or Email?

  • 1
    Have you tried if the {User.Name} token works in 2010. I have a feeling it was new in 2013, but it doesn't hurt to give it a try Jan 6 '15 at 13:41
  • 1
    As | is used as a separator in the claim i:05.t|asdf saml v3|UserInitials@domain.com, see if this question helps you sharepoint.stackexchange.com/questions/121394/… Jan 6 '15 at 14:37
  • @RobertLindgren It doesnt seem to work unfortunately.
    – user2536
    Jan 6 '15 at 18:57
  • @NadeemYousuf Luckily that is not an issue that I have come across.
    – user2536
    Jan 6 '15 at 19:06

Your Answer

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