CRM 2011 QueryExpresison - Kullanıcı TimeZone Ayarları Çekme ( Retrive Current User TimeZone Settings)


public static  UserSettings GetCurrentUsersTimeZoneSettings(IOrganizationService crmService, Guid userid, ColumnSet columnset)
        {
            try
            {
                QueryExpression query = GetQueryExpressionSingle("usersettings", "systemuserid", userid, columnset);
                EntityCollection ec = crmService.RetrieveMultiple(query);
                if (ec != null && ec.Entities.Count == 1)
                    return (UserSettings)ec.Entities[0];
                else
                    return new UserSettings();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

GetQueryExpressionSingle metodu


Metot Kullanımı

UserSettings abc = CrmManagerStatic.GetCurrentUsersTimeZoneSettings(crmService, new Guid("D91E53ED-4AC1-E211-87D1-0050569505A4"), new ColumnSet("localeid", "timezonebias", "timezonecode"));
if (abc != null && abc.Id != Guid.Empty){

}
                                   

Hiç yorum yok:

Yorum Gönder