LabelQueryExpression Kelas

Defines the languages for the labels to be retrieved for metadata items that have labels.

Ruang nama: Microsoft.Xrm.Sdk.Metadata.Query
Perhimpunan: Microsoft.Xrm.Sdk (dalam Microsoft.Xrm.Sdk.dll)

[DataContractAttribute(Name="LabelQueryExpression", Namespace="")] 
public sealed class LabelQueryExpression : MetadataQueryBase

The number of labels returned for each item depends on the number of language packs installed by the organization. If no additional language packs are installed, there will only be labels for the organization base language. For best performance when additional language packs are installed you can limit labels to those that correspond to the user’s language preference. These preferences can be determined using the values returned by the client-side context getUserLcid function or by querying the UserSettings.UILanguageId value.

The following example shows those portions of the Sample: Query Metadata and Detect Changes which deal with setting the LabelQueryExpression.

private Guid _userId;
private int _languageCode;
_userId = ((WhoAmIResponse)_service.Execute(new WhoAmIRequest())).UserId;
_languageCode = RetrieveUserUILanguageCode(_userId);
protected int RetrieveUserUILanguageCode(Guid userId)
 QueryExpression userSettingsQuery = new QueryExpression("usersettings");
 userSettingsQuery.ColumnSet.AddColumns("uilanguageid", "systemuserid");
 userSettingsQuery.Criteria.AddCondition("systemuserid", ConditionOperator.Equal, userId);
 EntityCollection userSettings = _service.RetrieveMultiple(userSettingsQuery);
 if (userSettings.Entities.Count > 0)
  return (int)userSettings.Entities[0]["uilanguageid"];
 return 0;

//A label query expression to limit the labels returned to only those for the user's preferred language
LabelQueryExpression labelQuery = new LabelQueryExpression();


Sebarang ahli statik awam (Shared dalam Visual Basic) jenis ini adalah selamat rentetan. Dalam apa jua keadaan, ahli tidak dijamin selamat rentetan.

Development Platforms

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Target Platforms

Windows 98,Windows 2000,Pelayan Windows 2000,Windows CE,Windows Server 2008,Windows 98 Edisi Kedua,Pocket PC,Telefon Pintar,Windows Server 2003,Windows XP Professional,Windows Server 2008,Windows Server 2012,Windows 7,Windows 8,Windows 8.1

Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.