本文整理汇总了C#中OrganizationService.RetrieveMultiple方法的典型用法代码示例。如果您正苦于以下问题:C# OrganizationService.RetrieveMultiple方法的具体用法?C# OrganizationService.RetrieveMultiple怎么用?C# OrganizationService.RetrieveMultiple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrganizationService
的用法示例。
在下文中一共展示了OrganizationService.RetrieveMultiple方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetYelpAccounts
private EntityCollection GetYelpAccounts()
{
CrmConnection connection = CrmConnection.Parse(_connection);
using (_orgService = new OrganizationService(connection))
{
var query = new QueryExpression
{
EntityName = "account",
ColumnSet = new ColumnSet("test9_yelpid"),
Criteria = new FilterExpression
{
Conditions =
{
new ConditionExpression
{
AttributeName = "test9_yelpid",
Operator = ConditionOperator.NotNull
}
}
}
};
return _orgService.RetrieveMultiple(query);
}
}
示例2: IsAuthenticated
public async Task<bool> IsAuthenticated(PortalUser user)
{
string Url = ConfigurationManager.AppSettings["URL"].ToString();
string CrmConnectionString = string.Format("Url={0}; Username={1}; Password={2}",
Url, user.Username, user.Password);
ClientCredentials credential = new ClientCredentials();
credential.UserName.UserName = user.Username;
credential.UserName.Password = user.Password;
CrmConnection crmConnection = CrmConnection.Parse(CrmConnectionString);
crmConnection.ClientCredentials = credential;
OrganizationService service = new OrganizationService(crmConnection);
QueryExpression qe = new QueryExpression("systemuser");
qe.ColumnSet = new ColumnSet();
qe.ColumnSet.AddColumn("systemuserid");
qe.ColumnSet.AddColumn("fullname");
qe.Criteria = new FilterExpression();
qe.Criteria.AddCondition("domainname", ConditionOperator.Equal, user.Username);
EntityCollection collection = service.RetrieveMultiple(qe);
if (collection.Entities.Count == 0)
{
return false;
}
return true;
}
示例3: DeleteInactiveProfiles
public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
//MAS
using (OrganizationService service = new OrganizationService(OurConnect()))
{
ConditionExpression appCondition = new ConditionExpression();
ConditionExpression authenticationCondition = new ConditionExpression();
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
switch (authenticationOption)
{
case ProfileAuthenticationOption.Anonymous:
authenticationCondition.AttributeName = consts.isanonymous;
authenticationCondition.Operator = ConditionOperator.Equal;
authenticationCondition.Values.Add(true);
break;
case ProfileAuthenticationOption.Authenticated:
authenticationCondition.AttributeName = consts.isanonymous;
authenticationCondition.Operator = ConditionOperator.Equal;
authenticationCondition.Values.Add(false);
break;
default:
break;
}
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(appCondition);
filter.Conditions.Add(authenticationCondition);
QueryExpression query = new QueryExpression(consts.userprofile);
query.ColumnSet.AddColumn(consts.username);
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query);
string[] usersToDelete = null;
int j = 0;
for(int i=0;i<collection.TotalRecordCount;i++)
{
if (DateTime.Compare(lastActivity((string)collection.Entities[i][consts.username], String.Empty), userInactiveSinceDate) < 0)
{
usersToDelete[j] = (string)collection.Entities[i][consts.username];
j++;
}
}
return DeleteProfiles(usersToDelete);
}
}
示例4: Get
public JsonResult<NewOppCount> Get(string userId)
{
OrganizationService orgService;
CrmConnection connection = CrmConnection.Parse(
ConfigurationManager.ConnectionStrings["CRMConnectionString"].ConnectionString);
using (orgService = new OrganizationService(connection))
{
//Query the CRM data based on the user id being passed in
FetchExpression query = new FetchExpression(@"
<fetch distinct='true' aggregate='true' >
<entity name='opportunity' >
<attribute name='opportunityid' alias='NewOppCount' aggregate='count' />
<attribute name='ownerid' alias='ownerid' groupby='true' />
<filter type='and' >
<condition attribute='ownerid' operator='eq' value='" + userId + @"' />
<condition attribute='createdon' operator='today' />
</filter>
</entity>
</fetch>");
//Get the result values for output
EntityCollection results = orgService.RetrieveMultiple(query);
string username =
(string)results.Entities[0].GetAttributeValue<AliasedValue>("ownerid_owneridname").Value;
int count =
(int)results.Entities[0].GetAttributeValue<AliasedValue>("NewOppCount").Value;
NewOppCount result = new NewOppCount
{
Username = username,
Message = "New Opps Today:",
Count = count
};
//Return JSON or XML
return Json(result);
}
}
示例5: Main
static void Main(string[] args)
{
try
{
logfilename = string.Format("{0}.log", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
log("BEGIN");
log("This code is supplied as is without guarantee. The latest code can be download from https://mscrmworkflowrunner.codeplex.com/");
if (args.Count() != 1)
{
throw new Exception("Invalid argument: config xml file.");
}
log(string.Format("Config file: {0}", args[0].ToString()));
var configxml = new XmlDocument();
configxml.Load(args[0].ToString());
var connectionstring = configxml.SelectSingleNode("//config/connectionstring").InnerText;
var workflownode = configxml.SelectSingleNode("//config/workflow");
var workflowname = workflownode.Attributes["name"] != null ? workflownode.Attributes["name"].Value : null;
Guid workflowid = workflownode.Attributes["id"] != null && !string.IsNullOrEmpty(workflownode.Attributes["id"].Value) ? new Guid(workflownode.Attributes["id"].Value) : Guid.Empty;
var fetchxml = configxml.SelectSingleNode("//config/fetchxml").InnerText;
var connection = CrmConnection.Parse(connectionstring);
var service = new OrganizationService(connection);
var context = new CrmOrganizationServiceContext(connection);
if (workflowid == Guid.Empty)
{
if (workflowname == null)
{
throw new Exception("Workflow name is required when no workflow id is specified!");
}
var query = new FetchExpression("<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
" <entity name='workflow'>" +
" <attribute name='workflowid' />" +
" <attribute name='name' />" +
" <filter type='and'>" +
" <condition attribute='category' operator='eq' value='0' />" +
" <condition attribute='type' operator='eq' value='1' />" +
" <condition attribute='name' operator='eq' value='" + workflowname + "' />" +
" </filter>" +
" </entity>" +
"</fetch>");
var workflows = service.RetrieveMultiple(query);
if (workflows.Entities.Count < 1)
{
throw new Exception(string.Format("A workflow with the name {0} could not be found!", workflowname));
}
else if (workflows.Entities.Count > 1)
{
throw new Exception(string.Format("More than one workflow with the name {0} found!", workflowname));
}
workflowid = workflows.Entities[0].Id;
}
var results = service.RetrieveMultiple(new FetchExpression(fetchxml));
foreach (var entity in results.Entities)
{
var req = new ExecuteWorkflowRequest()
{
EntityId = entity.Id,
WorkflowId = workflowid
};
try
{
service.Execute(req);
logsuccess(string.Format("Workflow request complete for entity id {0}", entity.Id.ToString()));
}
catch (Exception ex)
{
logerror(ex.Message);
}
}
}
catch (Exception ex)
{
logerror(ex.Message);
}
finally
{
log("END");
}
}
示例6: DeleteProfiles
public override int DeleteProfiles(string[] usernames)
{
//JH
using (OrganizationService service = new OrganizationService(OurConnect()))
{
int deletedProfiles = 0;
foreach(string user in usernames){
ConditionExpression usernameCondition = new ConditionExpression();
usernameCondition.AttributeName = consts.username;
usernameCondition.Operator = ConditionOperator.Equal;
usernameCondition.Values.Add(user);
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(usernameCondition);
QueryExpression query = new QueryExpression(consts.userprofile);
query.ColumnSet.AddColumn(consts.username);
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query);
service.Delete(consts.userprofile, collection.Entities[0].Id);
deletedProfiles++;
}
return deletedProfiles;
}
}
示例7: GetAllUsers
//receives as input a page index and page size of type integer and the total records of type out integer
//returns a collection containing all the users in the CRM account
//returns NULL if there are no users to return
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
{
//MAS
using (OrganizationService service = new OrganizationService(OurConnect()))
{
ConditionExpression deleteCondition = new ConditionExpression();
ConditionExpression appCondition = new ConditionExpression();//creates a new condition.
deleteCondition.AttributeName = consts.deleteduser;
deleteCondition.Operator = ConditionOperator.Equal;
deleteCondition.Values.Add(false);
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
FilterExpression filter = new FilterExpression(); //create new filter for the condition
filter.Conditions.Add(deleteCondition);
filter.Conditions.Add(appCondition);
QueryExpression query = new QueryExpression(consts.useraccount); //create new query
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query); //retrieve all records with same email
totalRecords = collection.TotalRecordCount;
if (totalRecords != 0 && totalRecords >= ((pageSize * pageIndex) + 1))
{
MembershipUserCollection usersToReturn = new MembershipUserCollection();
var start = pageSize * pageIndex;
var end = (pageSize * pageIndex) + pageSize;
for (int i = start; i < end; i++)
{
MembershipUser TempUser = GetUser((string)collection.Entities[i][consts.username]);
usersToReturn.Add(TempUser);
}
return usersToReturn;
}
else
{
return null;
}
}
}
示例8: DeleteUser
//receives a username string and a "delete all related data" boolean
//returns false if the user does not exist
//returns true if user data was deleted(soft delete, hard delete optional)
public override bool DeleteUser(string username, bool deleteAllRelatedData)
{
//tc
using (OrganizationService service = new OrganizationService(OurConnect()))
{
ConditionExpression usernameCondition = new ConditionExpression();
ConditionExpression deleteCondition = new ConditionExpression();
ConditionExpression appCondition = new ConditionExpression();
usernameCondition.AttributeName = consts.username;
usernameCondition.Operator = ConditionOperator.Equal;
usernameCondition.Values.Add(username);
deleteCondition.AttributeName = consts.deleteduser;
deleteCondition.Operator = ConditionOperator.Equal;
deleteCondition.Values.Add(false);
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(usernameCondition);
filter.Conditions.Add(appCondition);
QueryExpression query = new QueryExpression(consts.useraccount);
query.ColumnSet.AddColumn(consts.username);
query.ColumnSet.AddColumn(consts.deleteduser);
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query);
if (collection.Entities.Count == 0)
{
return false;
}
else
{
if (!deleteAllRelatedData)
{
collection.Entities[0][consts.deleteduser] = true;
activity(username, "Deleted", true);
service.Update(collection.Entities[0]);
return true;
}
else
{//hard delete
service.Delete(consts.useraccount, collection.Entities[0].Id);
return true;
}
}
}
}
示例9: GetUserRoles
/// <summary>
/// retrieves a list of CRM roles assigned to a specific user
/// </summary>
/// <param name="userid"></param>
/// <param name="service"></param>
/// <returns></returns>
private List<string> GetUserRoles(Guid userid, OrganizationService service)
{
List<string> roles = new List<string>();
string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
<entity name='role'>
<attribute name='name' />
<attribute name='businessunitid' />
<attribute name='roleid' />
<order attribute='name' descending='false' />
<link-entity name='systemuserroles' from='roleid' to='roleid' visible='false' intersect='true'>
<link-entity name='systemuser' from='systemuserid' to='systemuserid' alias='af'>
<filter type='and'>
<condition attribute='systemuserid' operator='eq' uitype='systemuser' value='{$USERID}' />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>";
fetchXml = fetchXml.Replace("$USERID", userid.ToString());
EntityCollection results = service.RetrieveMultiple(new FetchExpression(fetchXml));
foreach (Entity entity in results.Entities)
{
roles.Add((string)entity["name"]);
}
return roles;
}
示例10: Process
/// <summary>
/// runs the import process
/// </summary>
public void Process()
{
logger = LogManager.GetLogger(typeof(Importer));
LogMessage("INFO", "starting job");
ParseConnections();
SetupGuidMappings();
LogMessage("INFO","processing records");
OrganizationService sourceService = new OrganizationService(_sourceConn);
OrganizationService targetService = new OrganizationService(_targetConn);
foreach (var item in JobSteps)
{
JobStep step = (JobStep)item;
LogMessage("INFO",string.Format("starting step {0}", step.StepName));
string fetchQuery = step.StepFetch;
LogMessage("INFO"," retrieving records");
// Set the number of records per page to retrieve.
int fetchCount = 5000;
// Initialize the page number.
int pageNumber = 1;
// Specify the current paging cookie. For retrieving the first page,
// pagingCookie should be null.
string pagingCookie = null;
//create a list of entities to hold retrieved entities so we can page through results
List<Entity> ec = new List<Entity>();
while (true)
{
// Build fetchXml string with the placeholders.
string fetchXml = CreateXml(fetchQuery, pagingCookie, pageNumber, fetchCount);
EntityCollection retrieved = sourceService.RetrieveMultiple(new FetchExpression(fetchXml));
ec.AddRange(retrieved.Entities);
if (retrieved.MoreRecords)
{
// Increment the page number to retrieve the next page.
pageNumber++;
// Set the paging cookie to the paging cookie returned from current results.
pagingCookie = retrieved.PagingCookie;
}
else
{
// If no more records in the result nodes, exit the loop.
break;
}
}
LogMessage("INFO",string.Format(" {0} records retrieved", ec.Count));
if (ec.Count > 0)
{
foreach (Entity entity in ec)
{
//create a list to hold the replacement guids. a second pass is required because c# disallows modifying a collection while enumerating
List<KeyValuePair<string, object>> guidsToUpdate = new List<KeyValuePair<string, object>>();
LogMessage("INFO",string.Format(" processing record {0}, {1}", entity.Id, entity.LogicalName));
try
{
LogMessage("INFO"," processing GUID replacements");
foreach (KeyValuePair<string, object> attribute in entity.Attributes)
{
//LogMessage("INFO",string.Format("Attribute - {0} {1}", attribute.Key, attribute.Value.GetType().ToString()));
if (attribute.Value is Microsoft.Xrm.Sdk.EntityReference)
{
//LogMessage("INFO","getting source");
EntityReference source = ((EntityReference)attribute.Value);
try
{
//LogMessage("INFO","looking for GUID replacement");
Guid sourceId = source.Id;
Guid targetId = _mappings.Find(t => t.sourceId == source.Id).targetId;
source.Id = targetId;
guidsToUpdate.Add(new KeyValuePair<string, object>(attribute.Key, source));
//LogMessage("INFO",string.Format("replacement found - {0} -> {1}", sourceId, targetId));
}
catch (System.NullReferenceException ex)
{
//LogMessage("INFO", "NullReferenceException happened");
//do nothing because nullreferenceexception means there's no guid mapping to use
}
}
}
//now actually update the GUIDs with the mapped values
foreach (KeyValuePair<string, object> attribute in guidsToUpdate)
{
//LogMessage("INFO",string.Format(" replacing attribute GUID {0} {1}", attribute.Key, attribute.Value));
entity[attribute.Key] = attribute.Value;
//.........这里部分代码省略.........
示例11: GetSolutionsFromCrm
private EntityCollection GetSolutionsFromCrm(string connString)
{
try
{
CrmConnection connection = CrmConnection.Parse(connString);
using (_orgService = new OrganizationService(connection))
{
QueryExpression query = new QueryExpression
{
EntityName = "solution",
ColumnSet = new ColumnSet("friendlyname", "solutionid", "uniquename", "version"),
Criteria = new FilterExpression
{
Conditions =
{
new ConditionExpression
{
AttributeName = "ismanaged",
Operator = ConditionOperator.Equal,
Values = {false}
},
new ConditionExpression
{
AttributeName = "isvisible",
Operator = ConditionOperator.Equal,
Values = {true}
}
}
},
LinkEntities =
{
new LinkEntity
{
LinkFromEntityName = "solution",
LinkFromAttributeName = "publisherid",
LinkToEntityName = "publisher",
LinkToAttributeName = "publisherid",
Columns = new ColumnSet("customizationprefix"),
EntityAlias = "publisher"
}
},
Orders =
{
new OrderExpression
{
AttributeName = "friendlyname",
OrderType = OrderType.Ascending
}
}
};
return _orgService.RetrieveMultiple(query);
}
}
catch (FaultException<OrganizationServiceFault> crmEx)
{
_logger.WriteToOutputWindow("Error Retrieving Solutions From CRM: " + crmEx.Message + Environment.NewLine + crmEx.StackTrace, Logger.MessageType.Error);
return null;
}
catch (Exception ex)
{
_logger.WriteToOutputWindow("Error Retrieving Solutions From CRM: " + ex.Message + Environment.NewLine + ex.StackTrace, Logger.MessageType.Error);
return null;
}
}
示例12: UnlockUser
//recevies a username string
//returns false if user does not exist or is already unlocked
//returns true if user was locked, and unlocks the user account
public override bool UnlockUser(string userName)
{
using (OrganizationService service = new OrganizationService(OurConnect()))
{
ConditionExpression usernameCondition = new ConditionExpression();
ConditionExpression deleteCondition = new ConditionExpression();
ConditionExpression appCondition = new ConditionExpression();
usernameCondition.AttributeName = consts.username;
usernameCondition.Operator = ConditionOperator.Equal;
usernameCondition.Values.Add(userName);
deleteCondition.AttributeName = consts.deleteduser;
deleteCondition.Operator = ConditionOperator.Equal;
deleteCondition.Values.Add(false);
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(usernameCondition);
filter.Conditions.Add(deleteCondition);
filter.Conditions.Add(appCondition);
QueryExpression query = new QueryExpression(consts.useraccount);
query.ColumnSet.AddColumns(consts.lockn);
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query);
if (collection.Entities.Count == 0 || !(bool)collection.Entities[0][consts.lockn])
{
return false; //no user or already unlocked
}
else
{
collection.Entities[0][consts.lockn] = false;
service.Update(collection.Entities[0]);
activity(userName, "Unlocked", true);
return true;
}
}
}
示例13: ResetPassword
//receives the username and security answer strings
//returns null if the security answer is incorrect
//returns a reset password string if security answer is correct
public override string ResetPassword(string username, string answer)
{
//bcd
using (OrganizationService service = new OrganizationService(OurConnect()))
{
if (!EnablePasswordReset)
{
throw new NotSupportedException("Config file has been set to not allow password reset");
//return null;
}
else
{//reset password based on assigned regular expresssion
ConditionExpression usernameCondition = new ConditionExpression();
ConditionExpression deleteCondition = new ConditionExpression();
ConditionExpression appCondition = new ConditionExpression();
ConditionExpression answerCondition = new ConditionExpression();
usernameCondition.AttributeName = consts.username;
usernameCondition.Operator = ConditionOperator.Equal;
usernameCondition.Values.Add(username);
deleteCondition.AttributeName = consts.deleteduser;
deleteCondition.Operator = ConditionOperator.Equal;
deleteCondition.Values.Add(false);
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
appCondition.AttributeName = consts.securitypassword;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(answer); //TODO: (Curt) encrypt
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(usernameCondition);
filter.Conditions.Add(deleteCondition);
filter.Conditions.Add(appCondition);
QueryExpression query = new QueryExpression(consts.useraccount);
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query);
if (collection.Entities.Count == 0)
{
throw new MembershipPasswordException("The user's security answer is incorrect");
//return null;
}
else
{
string NewPass = Membership.GeneratePassword(_MinRequiredPasswordLength, _MinRequiredNonalphanumericCharacters); //changed to have MinRequireNonalphanumericCharacters (CC)
collection.Entities[0][consts.securitypassword] = NewPass; //TODO: (Curt) encrypt
service.Update(collection.Entities[0]);
activity(username, "Reset Password", true);
return NewPass;
}
}
}
}
示例14: GetUserNameByEmail
//receives a email of type string
//returns NULL if you users with specified email exist
//returns a string containing the first user with specified email
public override string GetUserNameByEmail(string email)
{
//bcd
using (OrganizationService service = new OrganizationService(OurConnect()))
{
ConditionExpression emailCondition = new ConditionExpression();
ConditionExpression deleteCondition = new ConditionExpression();
ConditionExpression appCondition = new ConditionExpression();
emailCondition.AttributeName = consts.email;
emailCondition.Operator = ConditionOperator.Equal;
emailCondition.Values.Add(email);
deleteCondition.AttributeName = consts.deleteduser;
deleteCondition.Operator = ConditionOperator.Equal;
deleteCondition.Values.Add(false);
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(emailCondition);
filter.Conditions.Add(deleteCondition);
filter.Conditions.Add(appCondition);
QueryExpression query = new QueryExpression(consts.useraccount);
query.ColumnSet.AddColumn(consts.username);
query.Criteria.AddFilter(filter);
EntityCollection collection = service.RetrieveMultiple(query);
if (collection.Entities.Count == 0)
return null;
else
{
Guid Retrieve_ID = collection[0].Id;
ColumnSet attributies = new ColumnSet(new string[] { consts.username });
Entity retrievedEntity = service.Retrieve(consts.useraccount, Retrieve_ID, attributies);
return retrievedEntity[consts.username].ToString();
}
}
}
示例15: GetUser
//receives a username of type string and a boolean value of the user's online status
//returns NULL if user is not online or if user does not exist
//returns user data of type MembershipUser if user is online
public override MembershipUser GetUser(string username, bool userIsOnline)
{
//JH
using (OrganizationService service = new OrganizationService(OurConnect()))
{
ConditionExpression usernameCondition = new ConditionExpression();
ConditionExpression deleteCondition = new ConditionExpression();
ConditionExpression appCondition = new ConditionExpression();
usernameCondition.AttributeName = consts.username;
usernameCondition.Operator = ConditionOperator.Equal;
usernameCondition.Values.Add(username);
deleteCondition.AttributeName = consts.deleteduser;
deleteCondition.Operator = ConditionOperator.Equal;
deleteCondition.Values.Add(false);
appCondition.AttributeName = consts.appname;
appCondition.Operator = ConditionOperator.Equal;
appCondition.Values.Add(_ApplicationName);
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(usernameCondition);
filter.Conditions.Add(deleteCondition);
filter.Conditions.Add(appCondition);
QueryExpression query = new QueryExpression(consts.useraccount);
query.Criteria.AddFilter(filter);
query.ColumnSet.AllColumns = true;
EntityCollection collection = service.RetrieveMultiple(query);
if (collection.Entities.Count == 0)
{
return null;
}
else
{
if (userIsOnline == (bool)collection.Entities[0][consts.online])
return GetUser((string)collection.Entities[0][consts.username]);
return null;
}
}
}