mardi 6 janvier 2015

Search query to find all tasks assigned to current user



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?








0 commentaires:

Enregistrer un commentaire