我正在尝试从中获取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);
}