1

我正在尝试从中获取SystemUser信息TeamMembership。我一直在尝试使用这些片段,但第一个片段是创建一个新实体,但不要检索用户的所有信息,如电子邮件地址、电话号码等......

foreach (TeamMembership user in teamMembers)
{
    sysUser.Id = user.SystemUserId.Value; 
    if (sysUser.InternalEMailAddress != string.Empty)
    {
        ActivityParty toParty = new ActivityParty();
        toParty.PartyId = new EntityReference(SystemUser.EntityLogicalName, user.SystemUserId.Value);
        toPartyList.Add(toParty);
    }    
}

然后我尝试了这个,但它没有返回任何东西!

// Get the Team Entity from the Workflow input parameter
Guid team = TeamName.Get<EntityReference>(executionContext).Id;
List<SystemUser> users =
    (from user in datacontext.CreateQuery<SystemUser>()
     join teamMembership in datacontext.CreateQuery<TeamMembership>()
     on user.SystemUserId.Value equals teamMembership.SystemUserId
     join thisteam in datacontext.CreateQuery<Team>() on teamMembership.TeamId.Value equals thisteam.TeamId.Value
     where thisteam.Name == TeamName.Get<EntityReference>(executionContext).Name
     select user).ToList();  

foreach(SystemUser user in users)
{
    if (user.InternalEMailAddress != null)
        LoggerObj.WriteLog("User " + user.FirstName + " Email:" + user.InternalEMailAddress);
}
4

1 回答 1

0

由于技术原因,我没有运行您的代码(阅读:我有点懒),但我想到您应该放宽 LINQ 语句中的条件。然后,一旦您进入任何 SystemUser实例,您就可以再次收紧它。如果即使在完全放松之后你什么也得不到,那你就会遇到另一个问题。:)

于 2013-03-12T19:21:39.863 回答